News

6 Reasons Why Google Says Valid HTML Is Important

A recent tweet from Google’s Gary Illyes has highlighted the issue of invalid HTML. While Google generally accepts invalid HTML, it’s less known that there can be negative consequences associated with it. Google’s support pages advise publishers to adhere to valid HTML standards.

Gary Illyes tweeted the following message:

“Dear JavaScript frameworks and plugins,
If you could stop putting invalid tags in the HTML head, like IMG and DIV, that would be great.
Yours truly,
Browsers”

JavaScript frameworks are collections of code that facilitate the development of apps and websites, speeding up the creation process. Plugins refer to add-ons for widely used content management systems.

Facebook sometimes requires advertisers to insert a tracking image code in the head section of a webpage, where it doesn’t belong. This can result in a series of HTML errors, impacting how efficiently Google crawls and indexes a page, especially with hreflang tags.

Google’s Stance on Valid HTML

According to Google’s support page on browser compatibility, invalid HTML is usually acceptable.

“Although we do recommend using valid HTML, it’s not likely to be a factor in how Google crawls and indexes your site.”

In 2017, John Mueller was questioned about the role of valid HTML in search rankings. Mueller clarified that valid HTML is not crucial.

John Mueller tweeted:

“As long as it can be rendered & SD extracted: validation pretty much doesn’t matter.”

Another publisher asked if valid HTML helps with ranking, and John Mueller gave a straightforward answer.

These are just a few reasons why Google suggests that publishers shouldn’t overly concern themselves with HTML validation. While most sites don’t validate, which hasn’t caused the Internet to collapse, there are still reasons to consider valid HTML.

Six Reasons Google Advises HTML Validation

  1. Could affect crawl rate
  2. Affects browser compatibility
  3. Encourages a good user experience
  4. Ensures that pages function everywhere
  5. Useful for Google Shopping Ads
  6. Invalid HTML in the head section breaks Hreflang

1. Valid HTML and Crawl Rate

A Google Search Console support page mentions that invalid HTML can affect the crawling and indexing of a page.

“Broken HTML or unsupported content on your pages: If Googlebot can’t parse the content of the page… it won’t be able to crawl them. Use Fetch as Google to see how Googlebot sees your page.”

2. Browser Compatibility

In another official support page, Google promotes using valid HTML to ensure proper page rendering.

GoogleBot uses Chrome version 41 for rendering sites. Valid HTML ensures that your site renders correctly across all browsers, including the GoogleBot’s version. For instance, CSS Custom Properties are not supported by the Chrome version used by GoogleBot.

“Clean, valid HTML is a good insurance policy, and using CSS separates presentation from content and can help pages render and load faster.”

Encourages Positive User Experience

Google considers user experience as part of its ranking process. While valid HTML might not be a ranking factor, it could indirectly improve user experience by helping pages render quickly and accurately across all devices and systems.

“Help visitors use your pages. Ensure that all links go to live web pages. Use valid HTML.”

4. Ensures that Pages Function Everywhere

Invalid HTML can cause browsers to operate in “quirks mode,” which sometimes impairs page functionality.

5. Valid HTML and Google Merchant Center

Google Merchant Center, which aids in creating Shopping Ads, recommends valid HTML.

“Use valid HTML. We also detect the price displayed based on your landing page structure. Using valid HTML helps ensure the correct price is detected.”

6. Invalid HTML in the Head Section Breaks Hreflang

During a 2016 Webmaster Hangout, it was revealed that invalid code in the head section could prevent Google from indexing hreflang tags.

As John Mueller explains:

“It might just be that we don’t recognize the hreflang markup at all on those pages. For example, pages might be crawled and indexed, but something in the head section can break everything, including the hreflang markup.”

Valid HTML Matters

Google’s support content emphasizes the importance of valid HTML. Gary Illyes’ recent tweet serves as a reminder of the significance of validating HTML, which helps safeguard webpages from unforeseen errors.

Advantages of Valid HTML

Matthew Edward, with extensive experience in editing web pages for validation, discusses the benefits of valid HTML:

“It can help prevent rendering issues some browsers overlook. Most errors that might prevent Google from crawling and indexing would be obvious when viewing the page.”

Valid HTML Doesn’t Matter

Despite the six reasons, most pages seem unaffected by poor HTML practices. It’s wise to ensure there are no unexplained crawl errors first while focusing on more important issues.

How do you feel about the validity of HTML? What’s your opinion?

Images by Shutterstock, Modified by Author
Screenshots by Author

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button