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 make sure search crawlers can fully understand your site.

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

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

More particularly, it’s important to keep the area of the HTML file at the top of the page. This section ought to contain the information that Google needs to read your website properly.

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

To make certain that the JavaScript isn’t hindering the area, Mueller suggests utilizing 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 contact the rendering tool in search console that the JS doesn’t mess up the section.”

Concerning the primary content, Mueller says its positioning is less important, though it’s crucial for the section to be tidy and efficient so Googlebot can appropriately understand it.

Mueller continues:

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

Down with JavaScript! (in the )”

Why Does The Positioning Of JavaScript Matter For SEO?

When creating a site, it’s finest to include JavaScript code at the bottom of the HTML document near the closing tag.

That’s due to the fact that JavaScript can delay 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 first, permitting the user to see the content while the JavaScript loads in the background.

In addition, you can prevent external JavaScript files from blocking the rendering of the page using the async or delay qualities.

Source: Reddit

Featured Image: StockEU/Best SMM Panel