Metadata not found if page has no <title>


#1

I was testing out summary cards, and tried to build a minimal example: nothing more than a doctype, head with meta tags, and empty body. I kept getting “WARN: No metatags found”. I found other topics that mentioned making sure the document had a Content-Type of text/html, but I confirmed that my web server served that. After some experimentation with less minimal examples, I discovered that the validator won’t find any meta tags if the page doesn’t have a title tag; once I added a title tag, the validator found the meta tags and rendered the summary card.

Posting in case anyone else hits the same problem, as well as to find out if this limitation could be either lifted or at least documented.

The following minimal sample did not work:

<!doctype html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta name="twitter:card" content="summary" />
    <meta name="twitter:site" content="@josh_triplett" />
    <meta name="twitter:title" content="Title test" />
    <meta name="twitter:description" content="Description test" />
  </head>
  <body>
  </body>
</html>

The following slightly less minimal sample did work:

<!doctype html>
<html>
  <head>
    <title>Title test</title>
    <meta charset="utf-8" />
    <meta name="twitter:card" content="summary" />
    <meta name="twitter:site" content="@josh_triplett" />
    <meta name="twitter:title" content="Title test" />
    <meta name="twitter:description" content="Description test" />
  </head>
  <body>
  </body>
</html>

#2

Interesting, thanks for sharing! I certainly was not aware of this. I’ll check in with the team and see if this is a known restriction.