Parmalink on pagination pages does not return a link of the current page why?

I am using the canonical header and I just noticed that using Permalink with Pagination pages does not give the current URL of the page.

How can I solve this issue, I am using different pagination with filters on different pages and I do not want to have many if statements in my head.html

How can I get the correct canonical URL for each page?

The paginated pages don’t have their own Permalinks. There’s a feature request issue open for this:

You can use the PageNumber variable:

If you have a lot of nested if conditions to deal with different page numbers, may be use index + dict to achieve a case-like statement.

You can get more directed answers if you explain your problem in detail and share a dummy site source outlining what you are trying to do e.g. share the if statement structure that you don’t like, and maybe someone has an idea to make that better.