I'm implementing a filtering option on my website where users can post and upvote images. The filtering options are: trending (by default) and new.

The URLs are like this:

  • example.com/tags/sunset/ ← Trending images (ALL images with more than 5 upvotes)
  • example.com/tags/sunset/?sort=new ← New images (ALL images ordered by descending date)

I'm using canonical URLs in order to avoid duplicate content. For example the two URLs above will have the same canonical URL (URL with trending content):


However I'm having a problem with the pagination canonical URLs.

There are 10 images per pages.

Let's say the sunset tag have 25 images (1,2,3 pages):


but only 15 are trending (1,2 pages):


The canonical URL for the URL filtered with new content (all image) will be:


However this URL will return an error 404 because there are not 3 pages of trending content for the tag sunset.

What can I do to avoid this issue?


I think in this situation I would forgo the canonical tags on the paginated pages where there is no matching canonical master paginated page to canonical too.

Keep the canonical tag on the first page (or maybe on the 2nd page to, if there is a 2nd page on the master pages) and just implement the rel=next/prev tags on the paginated pages to their first page.

IMO this is enough to sort any potential duplicate content, because in my experience paginated pages with rel=next/prev get removed from the SERPS anyway.

So your set up may look like:

First Page:


<link rel="canonical" href="https://example.com/tags/sunset/"/> 
<link rel="next" href="https://example.com/tags/sunset/?sort=new&page=2">

Second page: (you could also include the canonical tag if there is a page 2 on example.com/tags/sunset/?page=2)


<link rel="prev" href="https://example.com/tags/sunset/?sort=new">
<link rel="next" href="https://example.com/tags/sunset/?sort=new&page=3">

Last page in paginated sequence:


<link rel="prev" href="https://example.com/tags/sunset/?sort=new&page=2">

You could possibly go the route of adding noindex to the pages that have no master paginated page, but some may argue you will lose any SEO benefit from those pages then.

Not the answer you're looking for? Browse other questions tagged or ask your own question.