Google’s John Mueller: Move JavaScript Below HTML Headers

Posted by

Google’s John Mueller recommends placing JavaScript code below the HTML header tag to ensure search spiders can fully comprehend your site.

Mueller shares this suggestions in a Reddit thread, where a user asks whether HTML code placement might cause SEO problems.

The answer is yes; the placement 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 area of the HTML file at the top of the page. This area must consist of the info that Google needs to read your site properly.

Any JavaScript code should be positioned below the HTML headers.

To make sure that the JavaScript isn’t hindering the section, Mueller recommends using the rendering tool in Browse Console:

“The html headers () must be pretty much on top. I ‘d move any JS to listed below the HTML headers, and contact the rendering tool in search console that the JS doesn’t screw up the section.”

Relating to the primary material, Mueller says its placement is lesser, though it’s important for the section to be clean and efficient so Googlebot can appropriately comprehend it.

Mueller continues:

“For the content it does not matter as much, however considering that the head things is for machine-readable information that’s validated 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 Placement Of JavaScript Matter For SEO?

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

That’s because JavaScript can postpone the making of a webpage while it loads, resulting in a poor user experience.

By positioning the JavaScript at the bottom of the page, the HTML can be rendered initially, enabling the user to see the content while the JavaScript loads in the background.

Furthermore, you can avoid external JavaScript files from blocking the making of the page using the async or delay characteristics.

Source: Reddit

Included Image: StockEU/SMM Panel