Google’s John Mueller: Move JavaScript Below HTML Headers

Posted by

Google’s John Mueller recommends placing JavaScript code below the HTML header tag to make sure search spiders can fully understand your website.

Mueller shares this guidance in a Reddit thread, where a user asks whether HTML code placement might 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 section of the HTML file at the top of the page. This section should include the details that Google requires to read your website correctly.

Any JavaScript code need to be positioned below the HTML headers.

To make certain that the JavaScript isn’t hindering the section, Mueller advises utilizing the rendering tool in Browse Console:

“The html headers () ought to be pretty much 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 ruin the section.”

Regarding the main content, Mueller says its positioning is less important, though it’s vital for the section to be clean and well-organized so Googlebot can appropriately understand it.

Mueller continues:

“For the content it does not matter as much, but given that the head stuff is for machine-readable information that’s validated to be in a specific 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 since JavaScript can postpone the rendering of a website while it loads, resulting in a poor user experience.

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

Additionally, you can prevent external JavaScript files from blocking the making of the page using the async or defer attributes.

Source: Reddit

Included Image: StockEU/Best SMM Panel