Google’s John Mueller: Move JavaScript Below HTML Headers

Posted by

Google’s John Mueller suggests putting JavaScript code below the HTML header tag to make sure search crawlers can totally understand your website.

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

The response is yes; the placement 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 needs to contain the info that Google needs to read your site correctly.

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

To ensure that the JavaScript isn’t hindering the area, Mueller advises using the rendering tool in Search Console:

“The html headers () should be basically 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.”

Regarding the main material, Mueller states its placement is lesser, though it’s crucial for the area to be tidy and well-organized so Googlebot can properly understand it.

Mueller continues:

“For the content it doesn’t matter as much, but since the head things is for machine-readable details that’s validated 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 Placement Of JavaScript Matter For SEO?

When designing a website, it’s best to include JavaScript code at the bottom of the HTML file near the closing tag.

That’s because JavaScript can postpone the rendering of a web page while it loads, resulting in a bad user experience.

By putting 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.

Additionally, you can prevent external JavaScript files from obstructing the making of the page utilizing the async or delay qualities.

Source: Reddit

Included Image: StockEU/SMM Panel