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 ensure search spiders can totally understand your site.

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

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

More particularly, it’s important to keep the section of the HTML document at the top of the page. This area should include the information that Google needs to read your website effectively.

Any JavaScript code ought to be put below the HTML headers.

To ensure that the JavaScript isn’t hindering the area, Mueller recommends using the rendering tool in Search Console:

“The html headers () ought to 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 ruin the section.”

Regarding the main content, Mueller says its placement is lesser, though it’s essential for the section to be tidy and efficient so Googlebot can properly understand it.

Mueller continues:

“For the content it does not matter as much, but given that the head stuff is for machine-readable info that’s validated to be in a specific part of the page, it truly needs to be clean on top.

Down with JavaScript! (in the )”

Why Does The Placement Of JavaScript Matter For SEO?

When developing a site, it’s best to consist of 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, allowing the user to see the material while the JavaScript loads in the background.

In addition, you can avoid external JavaScript files from blocking the rendering of the page utilizing the async or postpone attributes.

Source: Reddit

Included Image: StockEU/Best SMM Panel