When it comes to pagination, canonical meta tags are the only search engine optimization feature to use. Well, at least that's what plenty of stores are used to. 

However, there are also the rel="next" and rel="prev" pagination elements that are equally important to your store SEO. They serve as a strong hint to search engines about the relationship between component URLs in a series of pages. This is typically used on category pages to accurately index and serve your customers' relevant pages.

In this guide, you'll learn how to add rel="prev" and rel="next" attributes easily with the help of the Magento 2 SEO Extension or manually.

To add rel="prev" and rel="next" attributes in Magento 2:

  1. Go to Stores > Configuration > Magefan Extensions > SEO and find the Pagination section.
  2. Enable the Use Rel="prev" and Rel="next" option.

Catalog Category Pagination Settings

It is literally that simple. 

However, if you still want to add these pagination attributes on your own, here's how you can do this.

Let's support you have the following sequence of pages:


Then this is how rel="prev" and rel="next" attributes should be arranged on each of those pages in the <head> section.

On the https://seo.demo.magefan.top/women/tops-women.html?p=1 there should be 

<link rel="next" href="https://seo.demo.magefan.top/women/tops-women.html?p=2" />

On the https://seo.demo.magefan.top/women/tops-women.html?p=2 there should be

<link rel="prev" href="https://seo.demo.magefan.top/women/tops-women.html?p=1" />
<link rel="next" href="https://seo.demo.magefan.top/women/tops-women.html?p=3" />

On the https://seo.demo.magefan.top/women/tops-women.html?p=3 there should be

<link rel="prev" href="https://seo.demo.magefan.top/women/tops-women.html?p=2" />
<link rel="next" href="https://seo.demo.magefan.top/women/tops-women.html?p=4" />

On the https://seo.demo.magefan.top/women/tops-women.html?p=4 there should be

<link rel="prev" href="https://seo.demo.magefan.top/women/tops-women.html?p=3" />

You should apply this to all of your categories and category pages. So that's a long manual and time-consuming process that should be done by developers.

So it is much easier to apply this search optimization tactic with the extension that does everything automatically.