Google’s John Mueller: Move JavaScript Below HTML Headers

Posted by

Google’s John Mueller suggests placing JavaScript code below the HTML header tag to guarantee search spiders can totally comprehend your website.

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

The response is yes; the positioning of HTML code could adversely impact your SEO efforts if it does not appear at the top of the page.

More specifically, it’s important to keep the area of the HTML document at the top of the page. This area ought to consist of the info that Google requires to read your site appropriately.

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

To make certain that the JavaScript isn’t interfering with the section, Mueller recommends utilizing the rendering tool in Browse Console:

“The html headers () need to be practically 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.”

Regarding the main material, Mueller states its positioning is less important, though it’s crucial for the section to be clean and well-organized so Googlebot can correctly understand it.

Mueller continues:

“For the content it does not matter as much, however given that the head stuff 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 Positioning Of JavaScript Matter For SEO?

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

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

By putting the JavaScript at the bottom of the page, the HTML can be rendered initially, allowing the user to see the material while the JavaScript loads in the background.

In addition, you can prevent external JavaScript files from blocking the making of the page using the async or delay attributes.

Source: Reddit

Featured Image: StockEU/Best SMM Panel