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 guarantee search crawlers can fully understand your site.

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

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

More particularly, it is necessary to keep the area of the HTML file at the top of the page. This area must contain the info that Google requires to read your website correctly.

Any JavaScript code should be put below the HTML headers.

To make sure that the JavaScript isn’t interfering with the area, Mueller suggests using the rendering tool in Browse Console:

“The html headers () should 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 area.”

Relating to the primary content, Mueller says its positioning is lesser, though it’s vital for the section to be tidy and well-organized so Googlebot can appropriately comprehend it.

Mueller continues:

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

Down with JavaScript! (in the )”

Why Does The Positioning 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 since JavaScript can delay the rendering of a website while it loads, leading to a poor user experience.

By putting the JavaScript at the bottom of the page, the HTML can be rendered first, permitting the user to see the material 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 defer attributes.

Source: Reddit

Included Image: StockEU/SMM Panel