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 ensure search spiders can completely comprehend your website.

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

The answer is yes; the placement of HTML code could adversely impact your SEO efforts if it does not appear at the top of the page.

More particularly, it is very important to keep the section of the HTML file at the top of the page. This area needs to contain the information that Google requires to read your website correctly.

Any JavaScript code must be placed listed below the HTML headers.

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

“The html headers () must be pretty much on top. I ‘d move any JS to listed below the HTML headers, and contact the rendering tool in search console that the JS does not mess up the section.”

Regarding the primary content, Mueller says its positioning is lesser, though it’s vital for the area to be clean and efficient so Googlebot can properly comprehend it.

Mueller continues:

“For the material it does not matter as much, however because the head things is for machine-readable info that’s confirmed to be in a particular part of the page, it truly requires to be clean on top.

Down with JavaScript! (in the )”

Why Does The Positioning Of JavaScript Matter For SEO?

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

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

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

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

Source: Reddit

Featured Image: StockEU/SMM Panel