Google’s John Mueller: Move JavaScript Below HTML Headers

Posted by

Google’s John Mueller recommends putting JavaScript code below the HTML header tag to guarantee search crawlers can completely understand your site.

Mueller shares this recommendations in a Reddit thread, where a user asks whether HTML code positioning could cause SEO problems.

The response is yes; the placement of HTML code might negatively affect your SEO efforts if it does not appear at the top of the page.

More specifically, it’s important to keep the section of the HTML file at the top of the page. This area should contain the details that Google needs to read your site effectively.

Any JavaScript code ought to be positioned below the HTML headers.

To ensure that the JavaScript isn’t disrupting the area, Mueller advises utilizing the rendering tool in Search Console:

“The html headers () need to be pretty much on top. I ‘d move any JS to listed below the HTML headers, and talk to the rendering tool in search console that the JS does not mess up the area.”

Regarding the main content, Mueller states its placement is lesser, though it’s important for the area to be tidy and efficient so Googlebot can correctly understand it.

Mueller continues:

“For the material it does not matter as much, however given that the head things is for machine-readable details that’s confirmed to be in a specific part of the page, it really requires to be tidy on top.

Down with JavaScript! (in the )”

Why Does The Placement 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 due to the fact that JavaScript can delay the making of a website while it loads, leading to a bad user experience.

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

Additionally, you can prevent external JavaScript files from blocking the making of the page using the async or defer attributes.

Source: Reddit

Included Image: StockEU/SMM Panel