Google’s John Mueller: Move JavaScript Below HTML Headers

Posted by

Google’s John Mueller recommends positioning JavaScript code below the HTML header tag to guarantee search spiders can completely understand 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 could negatively affect your SEO efforts if it doesn’t 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 consist of the information that Google requires to read your site correctly.

Any JavaScript code ought to be positioned listed below the HTML headers.

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

“The html headers () should be pretty much on top. I ‘d move any JS to below the HTML headers, and consult the rendering tool in search console that the JS does not screw up the area.”

Regarding the main content, Mueller states its positioning is lesser, though it’s essential for the section to be clean and well-organized so Googlebot can correctly understand it.

Mueller continues:

“For the material it doesn’t matter as much, however considering that the head things is for machine-readable details that’s confirmed to be in a specific part of the page, it truly requires 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 finest to include JavaScript code at the bottom of the HTML file near the closing tag.

That’s because JavaScript can delay the rendering of a web page 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, allowing the user to view the material while the JavaScript loads in the background.

Furthermore, you can avoid external JavaScript files from obstructing the rendering of the page utilizing the async or postpone qualities.

Source: Reddit

Featured Image: StockEU/SMM Panel