Google’s John Mueller: Move JavaScript Below HTML Headers

Posted by

Google’s John Mueller suggests positioning JavaScript code listed below the HTML header tag to guarantee search spiders can fully understand your website.

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

The answer is yes; the positioning of HTML code could adversely impact 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 should consist of the information that Google needs to read your site appropriately.

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

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

“The html headers () must be basically on top. I ‘d move any JS to below the HTML headers, and check with the rendering tool in search console that the JS doesn’t screw up the area.”

Regarding the main material, Mueller states its positioning is lesser, though it’s vital for the area to be tidy and efficient so Googlebot can appropriately comprehend it.

Mueller continues:

“For the material it does not matter as much, however considering that the head stuff is for machine-readable info that’s confirmed to be in a particular part of the page, it really needs 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 finest to include JavaScript code at the bottom of the HTML document near the closing tag.

That’s since JavaScript can postpone the making of a website while it loads, resulting in a bad user experience.

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

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

Source: Reddit

Included Image: StockEU/SMM Panel