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...
Read Full Story: https://news.google.com/__i/rss/rd/articles/CBMiRmh0dHBzOi8vd3d3LnNlcm91bmR0YWJsZS5jb20vZ29vZ2xlLWh0bWwtaGVhZC1zZWN0aW9uLWNsZWFuLTM0NzE5Lmh0bWzSAUpodHRwczovL3d3dy5zZXJvdW5kdGFibGUuY29tL2FtcC9nb29nbGUtaHRtbC1oZWFkLXNlY3Rpb24tY2xlYW4tMzQ3MTkuaHRtbA?oc=5
Your content is great. However, if any of the content contained herein violates any rights of yours, including those of copyright, please contact us immediately by e-mail at media[@]kissrpr.com.