Published: 19th Dec 2017 | Words: 807 | Reading Time: 5 minutes
Using rel meta tags on a webpage
If you don’t know what pagination is, it’s breaking up content into smaller sections which is very handy for things like a large catalogue of products or extensive articles. If you’re browsing products online you will usually have a number of products on a page and a number of pages, and you use the pagination menu to navigate between pages. A pagination menu is usually generated dynamically server side using PHP or similar to work out things like the number of products, the amount of products to display, and the overall number of pages which in turn allows the generating of the buttons to navigate between the pages. The big problem with catalogue pages is that they are technically only one page and you need to communicate this fact to search engines. Enter the rel="prev" and rel="next".
Pagination and rel tags
Figuring out these tags requires a good sense of logic. The rel="next" tag refers to the next page in the pagination (e.g. if you are on page 1, the next page is page 2). The rel=”prev” tag refers to the previous page in the pagination (e.g. if you are on page 3, the previous page is page 2). It seems very simple but there are some tricky issues. When you are on the first page of the pagination, page 1, you don’t want the rel=”prev” tag to show as there is no previous page in the pagination. Also for the last page in the series you don’t want rel=”next” tag to show as you are already on the last page and there is no next page. Another situation is if there is only 1 page in the pagination, as before there is no next page so the tag should not show.
URL parameters and rel tags
Here’s where it gets wild confusing so bear with me. On things like a product page with multiple pages and pagination, you may also have sorting options. An example is a dropdown that arranges the products by price high and price low. This changes the page content but the URL will usually have a URL parameter added to it. I assume that you will be dynamically building your URL within the rel tag, and you have to decide on what exactly is the next page in the pagination series. Generally in a pagination series you want all the pages indexed without sorting URL parameters and other parameters which just change the layout of the page content. The best thing to actually do is dynamically generate a noindex,nofollow robots tag when sorting options are applied to the page or you can quite literally end up with thousands of duplicate pages if you have a large number of different sorting parameters.
Page 1 issue
One of the most important things to know about paginated pages is the issue with page 1. Let’s say you have a paginated series of pages with only 2 pages, for example the URL could be ddmseo.com/catalogue.php. Now if you are using a URL “page” parameter which is used to pull the content your 2 URL’s in theory would be dmseo.com/catalogue.php?page=1 and dmseo.com/catalogue.php?page=2… in theory. But in reality you would not actually have a page parameter on the first page. Your 2 URL’s would simply be dmseo.com/catalogue.php and dmseo.com/catalogue.php?page=2. This causes a bit of an issue. When you are generating your pagination navigation and you are on page 2 the link back to page 1 will probably have a page=1 parameter, simply because of the way pagination is usually generated. What this does is create a duplicate first page as you can usually access it through dmseo.com/catalogue.php and dmseo.com/catalogue.php?page=1, which are separate URL’s. If you are not careful this can be a big problem. What you need to do with the rel=”prev” tag on page 2 is specify the first page without the URL parameter as the prev page and also use a canonical tag on the first page to avoid the duplicate content issue.
<link rel="prev" href="https://ddmseo.com/catalogue.php" /> // On page 2 the prev rel page tag would be as shown
<link rel="next" href="https://ddmseo.com/catalogue.php?page=3" /> // On page 2 the next rel tag would be