Google: Keep Your HTML Head Section Clean

Jan 12, 2023 - 7:11 am 2 by

Google Pencils

Google's John Mueller said that when it comes to your HTML head section, you want to ensure it is clean and tight. If possible, you don't want it to have broken syntax because it can break other parts of the page and make it hard for Google to read the page and your users.

And John said keep JavaScript out of your head section.

Yes, Google can handle broken HTML - I mean, most of the HTML on the web is probably not even close to 100% valid. So Google has to handle it. But when it comes to structured data or other technical, not visible, parts of your source code - try to validate it.

The question was on Reddit and it asked "Does Googlebot crawl from the top? Main HTML Content starts on line 5118 of Code - Is this an Issue for SEO?"

John replied, saying the content position in the HTML is not really the concern; it is the stuff around it that might break it or might make it hard for Google to pick up on that content. John wrote, "The html headers (head) should be pretty much on top. I'd move any JS to below the HTML headers, and check with the rendering tool in search console that the JS doesn't mess up the head section. For the content it doesn't matter as much, but since the head stuff is for machine-readable information that's verified to be in a specific part of the page, it really needs to be clean on top."

"Down with JavaScript! (in the head)," John added.

John was later asked about Google Tag Manager's location and he said, "Every situation is different. I'd look at what you do with GTM, test it in a browser & with the testing tools."

Years ago, John also said content position on a page doesn't matter anymore. Although, not too long before that, Gary Illyes from Google said not long ago that content order and position matters on mobile for rankings. And do you remember the days of SEOs obsessing about CSS positioning

Forum discussion at Reddit.

 

Popular Categories

The Pulse of the search community

Google Search Volatility

More Details

Search Video Recaps

 
Video Details More Videos Subscribe to Videos

Most Recent Articles

Search News

The Industry Mourns The Loss Of Bruce Clay: The Father Of SEO

Jun 26, 2026 - 2:28 pm
Google Updates

Google June 2026 Spam Update Has Finished Rolling Out

Jun 26, 2026 - 2:10 pm
Search Forum Recap

Daily Search Forum Recap: June 26, 2026

Jun 26, 2026 - 10:00 am
Search Video Recaps

Search News Buzz Video Recap: Google June 2026 Spam Update Hits Hard, Google Ads Strength Match Labels, AI Reporting Access & More

Jun 26, 2026 - 8:01 am
Google Ads

New: Google Ads Maximize Conversion Value Bidding For Standard Shopping

Jun 26, 2026 - 7:51 am
Google Ads

Google Merchant Center For Agencies New Security Controls

Jun 26, 2026 - 7:41 am
 
Previous Story: Doogler On Google Rocket