11ty / 11ty-website

Documentation site for the Eleventy static site generator.
https://www.11ty.dev/
MIT License
470 stars 678 forks source link

Use name attribute instead of property for Twitter meta tags? #1155

Open tannerdolby opened 3 years ago

tannerdolby commented 3 years ago

Open Graph protocol also specifies the use of property and content attributes for markup (<meta property="og:image" content="http://example.com/ogp.jpg"/>) while Twitter cards use name and content. Twitter’s parser will fall back to using property and content, so there is no need to modify existing Open Graph protocol markup if it already exists.

https://developer.twitter.com/en/docs/twitter-for-websites/cards/guides/getting-started

While Open graph meta tags use the property and content attributes, the Twitter card docs state they use name and content. Should these Twitter card meta tags use name instead of property? There might be a reason for keeping these twitter meta tags with property attributes (https://stackoverflow.com/questions/22350105/whats-the-difference-between-meta-name-and-meta-property)

for instance in base.njk L35-L43 these property attributes for twitter card metadata could be changed to name (unless they were explicitly defined with property attributes for a reason)

<!-- Twitter -->
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:site" content="@eleven_ty">
<meta property="twitter:creator" content="@zachleat">
<meta property="twitter:url" content="https://www.11ty.dev/">
<meta property="twitter:title" content="{{ subtitleText }}">
<meta property="twitter:description" content="{{ social.description }}">
<meta property="twitter:image" content="{{ social.imgsrc }}">
<meta property="twitter:image:alt" content="{{ social.imgalt }}">

cc @zachleat

tannerdolby commented 3 years ago

Related to #1157