Google’s John Mueller said It suggests “cleaning up” the HTML elements section so that search crawlers can fully understand your website.
Mueller shared this advice in a Reddit thread. A user asks if the placement of the HTML code could cause her SEO problems.
The answer is yes. Not putting the HTML code at the top of the page can negatively impact your SEO efforts.
Notes on Mueller’s remarks
John Mueller uses the term HTML header. But usually Elements are not referenced as such.
- HTML header
It is commonly understood (in informal terminology) to refer to elements (H1, H2, H3, etc.). - header element Including menus, logos, etc.
A specific HTML element called . - Head HTML element A section at the top of an HTML document that contains metadata about the document itself (title, meta description, etc.).
So when Mueller mentions “headers” he specifically We are discussing elements.
John Mueller on JavaScript in Head Elements
Mueller’s intention is that the HTML document It was to emphasize the importance of organizing sections and organizing them with scripts that could be placed elsewhere.
The element should only contain metadata about the document itself for use by browsers and search engines. This allows search engines to understand what the page is about and provides the browser and search engine with the data to render the web page appropriately (that is, display it). correctly).
Some JavaScript code that can be placed after an element should be placed after it.
After moving the JavaScript out of the section, Mueller recommends using Search Console’s rendering tools to see if the page is rendering correctly after the move.
“html header () should be almost at the top. Move the JS below the HTML header and in the Search Console rendering tool, the JS will appear as Make sure you didn’t mess up the section. “
As for the main content, according to Mueller, its placement is not very important, but so that Googlebot can understand it properly, It is important to keep the sections organized and organized.
Muller continues:
“While it’s less important with regards to content, the head part is for machine-readable information that has been identified to be in a specific part of the page, so it needs to be clean on top.
Down with JavaScript! ( inside)”
Why is JavaScript placement important for SEO?
When designing your website, we recommend using the async and defer attributes in strategic ways to achieve the best rendering and interactivity with the best page speed for your users.
This is because JavaScript can delay rendering while a web page is loading, degrading the user experience.
Render the HTML first to allow the user to view the content while the JavaScript loads in the background using the defer and async attributes appropriately.
sauce: Reddit
Featured Image: StockEU/Shutterstock