To make your pagination SEO-Friendly you need to use the rel="prev" and rel="next" tags in the <head> section like so
<link rel="prev" href="#page=1">
<link rel="next" href="#page=3">
These tags tell the search engine that a sequence of pages are connected, which can improve the SEO by helping search engines understand the the content flow and avoid indexing pages as duplicates.
I made a quick demo. Use the inspect tool to see the tags in the <head> section change as you change pages.
github link: https://github.com/hunzombi/SEO-FriendlyPaginationWithJavaScript
website link: https://hunzombi.github.io/SEO-FriendlyPaginationWithJavaScript/;
Top comments (0)