Skip to content

JavaScript and SEO Guidelines According To Google Webmasters

  • by

In the recently published episode of Ask Google Webmasters series, the hosts, Martin Splitt and John Mueller have provided answers to the most common technical questions that pertain to JavaScript and SEO guidelines. Below I have generated a summary of answers to the five most-asked questions.

Question 1: When Rails Asset Pipeline is used for caching purposes, what status code should you give to the old asset?

Answer 1: The best practice is to keep the old asset until Google recrawls the actual HTML content and gets new asset afterwards. In the event one decides to 404 old assets, there will be broken renders, it is something you want to prevent from happening.


Question 2: In pre-rendering, can you skip or replace irrelevant content? For example, SVG bar graphs generated by JavaScript, etc.

Answer 2: Generally speaking, one should include all content, so that when Google bot accesses the page, it sees everything.


Question 3: If your site has a chat function that rewrites the title tag for notifications to the visitor. How do you or the app supplier prevent Google from indexing the JavaScript rewritten version of the title tag?

Answer 3: You can’t do it, because as Google Bot renders the page it automatically picks up rewritten titles. The only workaround one could perform is to hide/delay the chat behind the user interaction. In that case, the user would have to click the chat button, which would subsequently activate the chat and change the title tag.


Question 4: In pre-rendering, can you still use JavaScript inside the rendered output?

Answer 4: You do not have to strip out JavaScript if you pre-render specific pages. You can use JavaScript inside the rendered output.


Question 5: Is pre-rendering or dynamic rendering ever going to go away?

Answer 5: Generally speaking, with the exception of dynamic rendering, pre-rendering is unlikely to go away. Server-side rendering and pre-rendering are fundamental concepts because they provide crawlers and users the content quicker. Dynamic rendering, on the other hand, is a workaround that may not exist for a very long time. 

You can review the video responses pertaining JavaScript and SEO guidelines via the official Google Webmasters YouTube channel