John Mueller, Google: Move JavaScript Below HTML Headers

John Mueller of Google says to put JavaScript below HTML headers.

Google’s John Mueller says that you should put JavaScript code under the HTML header so that search engines can understand it.

  • To make sure search crawlers can completely grasp your website, Google’s John Mueller advises putting JavaScript code behind the HTML header tag.
  • Mueller offers this guidance in response to a user’s question on Reddit about whether the placement of HTML code might affect SEO.

The short answer is yes; if the HTML code is not near the top of the page, it may negatively affect your SEO efforts .

More precisely, it’s crucial to maintain the HTML document’s section at the beginning of the page. The details Google requires to fully read your website should be in this area.

JavaScript script should always be inserted after the HTML headers.

Mueller advises making use of Search Console’s rendering tool to make sure that JavaScript isn’t interfering with the section.

According to Mueller, the location of the primary content is less critical than how well-organized and clean the section is in order for Googlebot to comprehend it.

Mueller continues to say

For the content, it doesn’t matter as much, but the head material really needs to be neat on top since it’s for machine-readable information that’s validated to be in a specific portion of the page.

Put an end to JavaScript! (At the top)

Why does placing in JavaScript affect SEO?

When creating a website, it is recommended to place the JavaScript code close to the closing element at the bottom of the HTML text.

This is because JavaScript can cause a website’s rendering to be delayed as it loads, which will negatively affect the user experience.

The HTML can be presented first by putting the JavaScript near the bottom of the page, allowing the user to read the content while the JavaScript loads in the background.

The async or defer properties can also be used to stop external JavaScript files from obstructing the page’s rendering.

Source: Search Engine Journal

Leave a comment

Your email address will not be published. Required fields are marked *