Google’s John Mueller: Move JavaScript Below HTML Headers

Posted by

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

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

The answer is yes; the positioning of HTML code might adversely affect your SEO efforts if it does not appear at the top of the page.

More particularly, it is very important to keep the area of the HTML file at the top of the page. This section must consist of the information that Google requires to read your website effectively.

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

To ensure that the JavaScript isn’t interfering with the section, Mueller suggests using the rendering tool in Search Console:

“The html headers () must be practically on top. I ‘d move any JS to below the HTML headers, and check with the rendering tool in search console that the JS does not screw up the section.”

Relating to the primary material, Mueller says its placement is lesser, though it’s essential for the section to be tidy and efficient so Googlebot can appropriately understand it.

Mueller continues:

“For the material it doesn’t matter as much, however given that the head stuff is for machine-readable info that’s confirmed to be in a particular 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 developing a website, it’s finest to consist of JavaScript code at the bottom of the HTML document near the closing tag.

That’s because JavaScript can delay the making of a webpage 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, enabling the user to see the content while the JavaScript loads in the background.

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

Source: Reddit

Featured Image: StockEU/Best SMM Panel