Google’s John Mueller: Move JavaScript Below HTML Headers

Posted by

Google’s John Mueller recommends putting JavaScript code listed below the HTML header tag to ensure search crawlers can fully comprehend your site.

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

The answer is yes; the placement of HTML code could adversely 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 file at the top of the page. This section needs to contain the information that Google requires to read your website appropriately.

Any JavaScript code should be put below the HTML headers.

To ensure that the JavaScript isn’t interfering with the area, Mueller recommends using the rendering tool in Search Console:

“The html headers () ought to be pretty much on top. I ‘d move any JS to below the HTML headers, and check with the rendering tool in search console that the JS doesn’t mess up the section.”

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

Mueller continues:

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

Down with JavaScript! (in the )”

Why Does The Placement Of JavaScript Matter For SEO?

When developing a site, it’s best 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 making of a website while it loads, resulting in a bad user experience.

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

Furthermore, you can avoid external JavaScript files from blocking the rendering of the page using the async or defer characteristics.

Source: Reddit

Featured Image: StockEU/Best SMM Panel