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 ensure search crawlers can fully comprehend your website.

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

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 particularly, it is essential to keep the section of the HTML file at the top of the page. This section must include the info that Google requires to read your site properly.

Any JavaScript code must be put below the HTML headers.

To make sure that the JavaScript isn’t hindering the area, Mueller suggests using the rendering tool in Search Console:

“The html headers () ought to be pretty much on top. I ‘d move any JS to listed below the HTML headers, and contact the rendering tool in search console that the JS does not ruin the section.”

Concerning the main content, Mueller states its positioning is less important, though it’s essential for the section to be clean and efficient so Googlebot can properly understand it.

Mueller continues:

“For the material it doesn’t matter as much, but since the head stuff is for machine-readable info that’s verified to be in a specific part of the page, it really needs 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 best to include JavaScript code at the bottom of the HTML file near the closing tag.

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

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

Furthermore, you can avoid external JavaScript files from obstructing the making of the page using the async or defer qualities.

Source: Reddit

Included Image: StockEU/Best SMM Panel