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 make sure search spiders can totally understand your website.

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

The response 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 essential to keep the section of the HTML file at the top of the page. This area should include the details that Google needs to read your website correctly.

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

To ensure that the JavaScript isn’t hindering the area, Mueller recommends using the rendering tool in Browse Console:

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

Regarding the primary content, Mueller says its placement is lesser, though it’s essential for the area to be tidy and well-organized so Googlebot can properly understand it.

Mueller continues:

“For the content it does not matter as much, however because the head stuff is for machine-readable info that’s verified to be in a specific part of the page, it actually requires to be clean on top.

Down with JavaScript! (in the )”

Why Does The Positioning Of JavaScript Matter For SEO?

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

That’s because JavaScript can delay the rendering of a web page while it loads, resulting in a poor user experience.

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

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

Source: Reddit

Included Image: StockEU/Best SMM Panel