You do not need to use
pushState to get Google to index content that is loaded into the page via AJAX when the URL doesn't change. There is no need to use
pushState at all in this instance.
To get Google to index a site that is fully powered by AJAX you need to:
- Create separate URLs for each piece of content and use
pushState to change the URL for human visitors as they navigate the site.
- Make sure that when a visitor starts on a deep URL, the correct content is loaded.
- Make sure that Googlebot can crawl all the content on the site by providing
<a href links to all the URLs within the site. For human visitors, you can intercept clicks on these links, use AJAX to load the content, and use
pushState to change the URL appropriately.
pushState is never required for Googlebot.
pushState is required for human visitors so that they can:
- Create bookmarks to sections of your site
- Keep the AJAX experience even when they perform actions that would normally cause page loads like clicking on links.
There is no need to use
pushState on the landing page before any clicks happen. In fact, doing so might prevent Googlebot from indexing your content correctly. You should only use
pushState as visitors transition to different content. Googlebot will load and render AJAX calls that are required during the
onload event of the page. There doesn't need to be (and shouldn't be) a
pushState call to make that happen.
The only caveat is that it takes Googlebot longer to render pages than the initial static content Googlebot crawl. Googlebot may crawl your site and find that it requires AJAX. Your page will get put in the render queue. It may take Googlebot up to two months to come back and get the AJAX for that page and perform the rendering. Only once your page is rendered will Google index the content of a page that requires AJAX to load the content. Pages that require AJAX and rendering will be indexed more slowly and it will take Google longer to see updates to them.