Google’s John Mueller: Move JavaScript Below HTML Headers

Posted by

Google’s John Mueller recommends putting JavaScript code below the HTML header tag to ensure search spiders can totally understand your site.

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

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

More specifically, it is necessary to keep the area of the HTML document at the top of the page. This area ought to contain the info that Google requires to read your site appropriately.

Any JavaScript code must be put below the HTML headers.

To ensure that the JavaScript isn’t disrupting the section, Mueller suggests using the rendering tool in Browse Console:

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

Regarding the main content, Mueller states its positioning is less important, though it’s vital for the area to be clean and efficient so Googlebot can effectively comprehend it.

Mueller continues:

“For the material it doesn’t matter as much, however because the head stuff is for machine-readable information that’s validated to be in a specific part of the page, it actually requires to be clean on top.

Down with JavaScript! (in the )”

Why Does The Placement Of JavaScript Matter For SEO?

When designing 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 postpone the making of a webpage while it loads, resulting in a poor user experience.

By positioning the JavaScript at the bottom of the page, the HTML can be rendered first, enabling the user to view the content while the JavaScript loads in the background.

Additionally, 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