Google’s John Mueller: Move JavaScript Below HTML Headers

Posted by

Google’s John Mueller suggests putting JavaScript code listed below the HTML header tag to guarantee search spiders can fully understand your website.

Mueller shares this suggestions in a Reddit thread, where a user asks whether HTML code positioning could trigger SEO issues.

The answer is yes; the positioning of HTML code could adversely affect your SEO efforts if it doesn’t appear at the top of the page.

More specifically, it is very important to keep the section of the HTML file at the top of the page. This section needs to consist of the details that Google requires to read your site correctly.

Any JavaScript code should be placed listed below the HTML headers.

To ensure that the JavaScript isn’t disrupting the section, Mueller recommends utilizing the rendering tool in Browse Console:

“The html headers () ought to be basically on top. I ‘d move any JS to below the HTML headers, and contact the rendering tool in search console that the JS does not ruin the section.”

Concerning the main content, Mueller says its placement is lesser, though it’s crucial for the area to be clean and efficient so Googlebot can appropriately comprehend it.

Mueller continues:

“For the material it does not matter as much, however given that the head stuff is for machine-readable details that’s confirmed to be in a particular part of the page, it truly needs to be clean on top.

Down with JavaScript! (in the )”

Why Does The Positioning Of JavaScript Matter For SEO?

When designing a website, it’s best to consist of JavaScript code at the bottom of the HTML file near the closing tag.

That’s since JavaScript can delay the rendering of a web page while it loads, leading to a poor user experience.

By positioning the JavaScript at the bottom of the page, the HTML can be rendered first, enabling the user to view the material while the JavaScript loads in the background.

Additionally, you can prevent external JavaScript files from obstructing the making of the page utilizing the async or delay characteristics.

Source: Reddit

Included Image: StockEU/SMM Panel