So I tried it.
I don’t use SSR (server-side-rendering) but I’d like to know, how can the Google indexing a page which fetches content via Ajax. I wanted a proof it works.
Therefore I created a Laravel app. A very simple one which gets data from the database and show it on a page.
Without Vue.js and Ajax the code looks like this:
I created the same page but this time I fetched the data via Ajax API calls:
The results of the two pages were the same. I installed the app to a server where I created two subdomains and added them two Google webmaster tool.
The first try was the Fetch as Google. I clicked on the Fetch and render button and waited for the result.
On the Fetching tab we can see the html source code. The main part of my page looked like this:
Not too promising. BUT! On the rendering page I found this:
So the googlebot can see what the users can see! Good news. But I didn’t stop here. I requested the indexing and waiting. And waiting. And waiting. Sometimes I checked google site and searching for this:
site:3-14.co final test
Finally next day I got something:
I tried one more thing. I was searching for this:
This way I could see if the normal page (without Ajax) is more recent on Google, but not:
We don’t need to be afraid to use API and Ajax calls in our applications even if the SEO is important to our site, because Google can fetch the content properly.