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

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

The answer is yes; the positioning of HTML code might negatively impact your SEO efforts if it doesn’t appear at the top of the page.

More particularly, it is necessary to keep the section of the HTML file at the top of the page. This section needs to consist of the information that Google requires to read your site appropriately.

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

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

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

Relating to the primary content, Mueller states its positioning is less important, though it’s essential for the section to be tidy and well-organized so Googlebot can appropriately comprehend it.

Mueller continues:

“For the content it doesn’t matter as much, but given that the head things is for machine-readable info that’s confirmed to be in a particular 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 creating a site, it’s finest to include JavaScript code at the bottom of the HTML file near the closing tag.

That’s because JavaScript can postpone the making of a website while it loads, leading to a poor user experience.

By positioning the JavaScript at the bottom of the page, the HTML can be rendered initially, permitting the user to see the material while the JavaScript loads in the background.

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

Source: Reddit

Included Image: StockEU/Best SMM Panel