0

A client is trying to use the w3 validator on his site. He implemented Twitter Cards this weekend using this post: http://yoast.com/twitter-cards/

However, this is causing the site to fail validation. With Facebook, you simply added xmlns:fb="http://www.facebook.com/2008/fbml" so the validator knew of the new syntax.

Anyone know Twitter's equivalent?

pnuts
  • 58,317
  • 11
  • 87
  • 139
Zach Inglis
  • 1,242
  • 1
  • 14
  • 28

3 Answers3

1

There isn't a Twitter equivalent. You'll have to accept the fact that using the Twitter specific meta tags will break validation or lay a glimmer of hope in the following snippet:

Twitter cards and Open Graph

[...] If you're already using OpenGraph to describe data on your page, it’s easy to generate a Twitter card without duplicating your tags and data. When the Twitter card processor looks for tags on your page, it first checks for the Twitter property, and if not present, falls back to the supported Open Graph property. This allows for both to be defined on the page independently, and minimizes the amount of duplicate markup required to describe your content and experience.

Their example follows on with this:

<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@nytimesbits">
<meta name="twitter:creator" content="@nickbilton">
<meta property="og:url" content="http://bits.blogs.nytimes.com/2011/12/08/a-
  twitter-for-my-sister/">
<meta property="og:title" content="A Twitter for My Sister">
<meta property="og:description" content="In the early days, Twitter grew so 
  quickly that it was almost impossible to add new features because engineers 
  spent their time trying to keep the rocket ship from stalling.">
<meta property="og:image" content="http://graphics8.nytimes.com/images/2011/12/
  08/technology/bits-newtwitter/bits-newtwitter-tmagArticle.jpg">

So while you will still use Twitter meta tags, the validation report will a tad less broken because you're using some Open Graph tags that should pass through. Provided you do include that namespace that accounts for the OGP tags.

Community
  • 1
  • 1
random
  • 9,774
  • 10
  • 66
  • 83
1

To fix it, change attribute name to property:

    <meta name="twitter:card value=summary"> 

changed to

    <meta property=:twitter:card content=summary">
Bass Jobsen
  • 48,736
  • 16
  • 143
  • 224
0

I've seen sites using xmlns:twitter="http://api.twitter.com/" , but i can't seem to find the documentation.

Michel
  • 71
  • 1
  • 2