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 ensure search spiders can fully comprehend your site.

Mueller shares this suggestions in a Reddit thread, where a user asks whether HTML code placement might trigger SEO concerns.

The answer is yes; the placement of HTML code could negatively impact 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 document at the top of the page. This section needs to contain the details that Google needs to read your website effectively.

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

To make sure that the JavaScript isn’t disrupting the section, Mueller recommends using the rendering tool in Browse Console:

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

Regarding the main content, Mueller states its placement is lesser, though it’s vital for the section to be tidy and efficient so Googlebot can appropriately comprehend it.

Mueller continues:

“For the content it does not matter as much, but since the head stuff is for machine-readable information that’s confirmed to be in a particular part of the page, it truly needs to be tidy on top.

Down with JavaScript! (in the )”

Why Does The Placement Of JavaScript Matter For SEO?

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

That’s because JavaScript can postpone the making of a website while it loads, resulting in a poor user experience.

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

Additionally, you can avoid external JavaScript files from blocking the making of the page utilizing the async or delay attributes.

Source: Reddit

Included Image: StockEU/Best SMM Panel