Pagination creates additional pages. For example, if the site has correct pages with numbers P24/P48/P72, then pages with P23/P75/P12345667890 may multiply. This can happen for various reasons.
We need to add the rel=canonical meta tag.
For example:
Pagination creates pages with 24 elements. The second page will have the address /P24, the third /P48, the fourth /72, and so on. We need to get this P24/P48/P72 value to insert into rel-canonical The problem is that {paginate}{current_page}{/paginate} in the {exp:channel:entries} tag and limit=1 will give numbers P25/P49/P73.
How to get the correct number? Is it possible to use a mathematical operation (-1 from the current_page value without using Add-on and PHP?
It’s probably difficult. It’s easier to avoid any duplicates from appearing by not allowing them to appear by specifying clear instructions for the last segment (P00) in the tag. I’ve already decided that.
If you are interested… I have make pagination pages by 50 (paginate P50, P100, P150, P200…). And set the following condition:
{if segment_3 == "" OR segment_3 $= "00" OR segment_3 $= "50"}{if:else}{redirect='404'}{/if} {if segment_4}{redirect='404'}{/if}
here if the page number ends neither 00 or 50, then a 404 error is issued. If adiitional segment appears, then also a 404.
The above condition will work. The non-numeric segment also ends with neither 00 nor 50.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.