Google’s John Mueller: Move JavaScript Below HTML Headers

Posted by

Google’s John Mueller suggests placing JavaScript code listed below the HTML header tag to ensure search crawlers can totally understand your website.

Mueller shares this advice in a Reddit thread, where a user asks whether HTML code placement might cause SEO issues.

The answer is yes; the positioning of HTML code might adversely 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 file at the top of the page. This section must contain the info that Google needs to read your website effectively.

Any JavaScript code must be placed below the HTML headers.

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

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

Relating to the primary content, Mueller states its placement is less important, though it’s essential for the area to be clean and efficient so Googlebot can correctly comprehend it.

Mueller continues:

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

Down with JavaScript! (in the )”

Why Does The Placement Of JavaScript Matter For SEO?

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

That’s since JavaScript can delay the rendering of a website while it loads, leading to a bad 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.

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

Source: Reddit

Featured Image: StockEU/Best SMM Panel