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 totally comprehend your site.

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

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

More specifically, it is very important to keep the section of the HTML document at the top of the page. This area needs to include the info that Google requires to read your site effectively.

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

To ensure that the JavaScript isn’t hindering the section, Mueller recommends utilizing 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 talk to the rendering tool in search console that the JS doesn’t ruin the area.”

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

Mueller continues:

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

That’s due to the fact that JavaScript can postpone the rendering of a website while it loads, leading to a bad user experience.

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

Additionally, you can avoid external JavaScript files from blocking the rendering of the page using the async or delay attributes.

Source: Reddit

Featured Image: StockEU/SMM Panel