I'm trying to implement ajax calls to load parts of a page only when a user gets to that part of the page and make sure at the same time that Google is able to read the content.
Here is what I have done:
- created a link "view comments" on my page and adding
#!module=comments
to the url - on PHP side I capture the escaped_fragment and load static html
- client side I have created a script that loads the static html when clicking on the link
It works fine. When I click on the link, I see the static content being loaded. If I access the URL directly (escaped_fragment) it also display the content correctly.
Now the SEO part with GoogleBot...
There is a possibility to simulate crawling from the Google Search Console. I tested the url with the script and I logged all visits on the static html page to see if Googlebot was getting there. The good news is that I see GoogleBot visiting the static html page.
How do I know if the static content of this page has been added to the main page? (and not seen as separate content) I'd like to transform all my pages with ajax loading if I'm not sure to do the right thing.