On a website, there are many pages with a component for users to leave comments. To reduce page load time and since few users use the commenting system, the commenting component is loaded via AJAX after the page is loaded. The issue: how can we get Google to index dynamic content that is loaded via AJAX on page load?
Many other pages on AJAX & SEO suggest letting Google index the content as a separate page. This is not a valid solution here - we do not want the comments for an item to be a unique page.
The solution we are considering:
Create two versions of the page (one static, one dynamic):
- www.example.com/page/comments_on (load comments statically)
- www.example.com/page (load comments after page load via AJAX)
Then, set the canonical URL of www.example.com/page/comments_on to www.example.com/page. We would put both URLs in our sitemap.xml.
Will this work? What are the downsides to this approach? What other approaches are there to handle this situation?