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 crawlers can fully comprehend your website.

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

The response is yes; the positioning of HTML code might adversely impact your SEO efforts if it does not appear at the top of the page.

More particularly, it is necessary to keep the area of the HTML document at the top of the page. This area ought to consist of the details that Google needs to read your website correctly.

Any JavaScript code should be placed below the HTML headers.

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

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

Concerning the primary content, Mueller states its placement is less important, though it’s crucial for the area to be clean and efficient so Googlebot can appropriately understand it.

Mueller continues:

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

Down with JavaScript! (in the )”

Why Does The Placement Of JavaScript Matter For SEO?

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

That’s because JavaScript can delay the rendering 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, permitting the user to see the material while the JavaScript loads in the background.

Furthermore, you can avoid external JavaScript files from blocking the rendering of the page using the async or postpone characteristics.

Source: Reddit

Featured Image: StockEU/SMM Panel