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 spiders can fully understand your website.

Mueller shares this guidance 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 impact your SEO efforts if it doesn’t appear at the top of the page.

More specifically, it’s important to keep the section of the HTML file at the top of the page. This section must contain the info that Google requires to read your website correctly.

Any JavaScript code should be put listed below the HTML headers.

To make sure that the JavaScript isn’t interfering with the area, Mueller suggests utilizing the rendering tool in Search Console:

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

Regarding the primary content, Mueller states its positioning is less important, though it’s vital for the area to be tidy and well-organized so Googlebot can properly understand it.

Mueller continues:

“For the material it doesn’t matter as much, however since the head stuff is for machine-readable info that’s verified to be in a particular 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 designing a site, it’s best to include JavaScript code at the bottom of the HTML file near the closing tag.

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

By placing the JavaScript at the bottom of the page, the HTML can be rendered first, permitting the user to view the material while the JavaScript loads in the background.

In addition, you can avoid external JavaScript files from obstructing the rendering of the page utilizing the async or delay attributes.

Source: Reddit

Included Image: StockEU/Best SMM Panel