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 ensure search spiders can completely understand your site.

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

The response is yes; the placement of HTML code might adversely affect your SEO efforts if it doesn’t appear at the top of the page.

More specifically, it is essential to keep the section of the HTML document at the top of the page. This area must include the information that Google needs to read your site appropriately.

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

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

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

Concerning the primary content, Mueller states its placement is lesser, though it’s essential for the area to be tidy and efficient so Googlebot can appropriately understand it.

Mueller continues:

“For the content it does not matter as much, however because the head stuff is for machine-readable details that’s validated to be in a specific part of the page, it really requires to be clean on top.

Down with JavaScript! (in the )”

Why Does The Positioning Of JavaScript Matter For SEO?

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

That’s since JavaScript can postpone the rendering of a web page while it loads, resulting in a bad 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 prevent external JavaScript files from obstructing the making of the page utilizing the async or defer qualities.

Source: Reddit

Featured Image: StockEU/Best SMM Panel