: Is there a better way to implement dynamic pagination in javascript for SEO? So I don't have access to any server side languages only javascript. I currently have pagination implemented on a
So I don't have access to any server side languages only javascript. I currently have pagination implemented on a page that dynamically pulls in data from an xml file. Below is an example of the pagination html, this example being on page 4. Each time you click a page number or arrow the code is regenerated based off the url variable while moving the rel attributes where they need to be. Is this best route for SEO or is there a better way?
Also should the canonical tag just be the base url like : PATH/all-content.html or should that be generated as each page changes as well. Like PATH/all-content.html?page=4
<div id="pagination">
<a rel="prev" class="prev" href="?page=3">
<i class="fa fa-angle-left" aria-hidden="true"></i>
</a>
<span class="page-num-container">
<a href="?page=1">1</a>
<a href="?page=2">2</a>
<a href="?page=3" rel="prev">3</a>
<a class="current" href="?page=4">4</a>
<a href="?page=5" rel="next">5</a>
<a href="?page=6">6</a>
<a href="?page=7">7</a>
<a href="?page=8">8</a>
<a href="?page=9">9</a>
<i>...</i>
<a href="?page=18">18</a>
</span>
<a rel="next" class="next" href="?page=5">
<i class="fa fa-angle-right" aria-hidden="true"></i>
</a>
More posts by @Hamm4606531
1 Comments
Sorted by latest first Latest Oldest Best
Unfortunately, this is not how rel="prev" and rel="next" work. They should be placed on <link> elements in the <head> tag, not on <a> elements.
The canonical URL can contain the specific URL, so including the page parameters.
You can learn more about the specific of rel="prev" and rel="next" or here: support.google.com/webmasters/answer/1663744?hl=en
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.