tech support 8

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Monday, 25 June 2012

Twitter Cards Are Now Valid HTML

Posted on 10:08 by Unknown


Screen capture of an expanded tweet from the Twitter web site.If you've used the Twitter web interface much you might have noticed that sometimes a tweet that links to a popular site includes previews of the pictures, or perhaps video, or even maps.




For example, when I check into a venue on Foursquare and allow that to be auto-tweeted, the web version of my tweet includes venue details including a map, address, number of check-ins and (if I posted a photo) a cropped picture.




This sample image shows how that appears (albeit scaled down to fit on this page since it's so darn tall), but sadly (or goodly, depending on your objective and grammar) the embedded tweet feature doesn't contain all that detail when drawn:



Some of the smaller kids at Buffalo Soccer Club working on their moves. (@ JFK Recreation Center) [pic]: 4sq.com/Mb0qMT

— Adrian Roselli (@aardrian) June 21, 2012




If you go directly to the Foursquare page for that check-in and look at the source code you will find these two meta tags (among many others):





<meta value="@foursquare" name="twitter:site" />

<meta value="photo" name="twitter:card" />




In fact, if you look for other sites whose Twitter references tend to include images, videos, and so on, then you may find these meta tags rolling around in the page header. Here is a sample block from a YouTube video:





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

<meta name="twitter:site" value="@youtube">

<meta name="twitter:player" value="https://www.youtube.com/embed/dQw4w9WgXcQ">

<meta property="twitter:player:width" content="640">

<meta property="twitter:player:height" content="480">




This feature is called a Twitter Card, and Twitter has a detailed tutorial of how to enable Twitter Cards for your site at its developer site. If the code looks a bit familiar, it's based on Facebook's OpenGraph, which also stuffs content into meta tags for the use of Facebook embeds.




Not all sites that use Twitter cards will be automatically supported — at least not yet. Twitter is trying this out on some clearly major sites (Foursquare and YouTube are examples) and for anyone else to get their site content embedded into tweets like this they must apply to participate.




Unfortunately, you first have to implement Twitter cards on your site. Only once you have implemented them can you apply to participate, and even then there is no guarantee you'll be included. From Twitter's sign-up page:




As we roll out this new feature to users and publishers, we are looking for sites with great content and those that drive active discussion and activity on Twitter. Unfortunately we will not be able to respond to or approve all requests.



Even more unfortunately, the documentation Twitter provided (as of Friday morning) required you to use meta tags that would not validate. In both HTML4 and HTML5, a meta tag with a name attribute must have a corresponding content attribute, not a value attribute (or, more accurately, there is no content attribute).




A developer filed a bug report noting that the Twitter card code as presented on Twitter's site does not validate. Though Twitter did not respond to this bug report, on Friday afternoon Twitter updated its sample to make the code valid HTML — though nowhere in its document does Twitter notify readers what was updated or that the unnamed change made the code valid.




For those of us who implemented the Twitter Card on our sites in anticipation of wider roll-out of this feature, we are now faced with going through our code to update it at additional expense. Sadly, since this is relatively new and unannounced, there is no way to notify developers that the code has changed.




Twitter will now also be forced to support both variants, since it's clear Foursquare, YouTube, and probably everyone else who has this code in place has not changed it since Friday and may not change it for some time to come. In the end, if web developers just copy content from other sites as a base, they could end up propagating this bad markup.




Having already set up pages on our not-for-profit Buffalo Soccer Club site to use Twitter Cards on Friday morning (which Twitter does not honor yet), I now have to go back through and change them to use the new and valid meta. On the bright side, if you use a content management system that allows you to put custom meta tags on your pages, then you may not need to spend any money to get a developer to implement this feature (hint about our CMS, QuantumCMS).




The bright spot to this story is that Twitter made the change and the code will validate. Those of us trying to be early adopters should be more than happy to make the change.




Interesting aside — I actually wrote this up on Friday when the Twitter code was still broken, but when I went back to review/edit this post on Friday I saw Twitter had updated its code. I hate wasting a blog post, so you have now read my re-write.



Update: March 26, 2013




A List Apart has a new story today outlining not just Twitter cards, but also the the Open Graph meta data that pre-dates Twitter cards: “Like”-able Content: Spread Your Message with Third-Party Metadata

Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in html, standards, Twitter, W3C | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • Browser Performance Chart
    Jacob Gube has posted a handy chart over at Six Revisions titled " Performance Comparison of Major Web Browsers ." He tests the c...
  • Google Dashboard: What Google Knows about You
    Google announced a new service/feature today, Google Dashboard . Given all the services Google offers and all the ways you can interact with...
  • Facebook, HTML5, and Mis-Reporting
    My Twitter stream and the headlines of sites across the web yesterday lit up with Facebook's CEO blaming its stock price (failure to mee...
  • App Store Meta Tags
    Why yes, Dominos, I'd love to tap again to get your real home page to order a pizza when I could have done it right here, below your ove...
  • Speaking at Mom 2.0 in Houston, TX
    I will be in Houston this week to speak at the Mom 2.0 Summit (Feb. 18-20, 2010, Houston, TX). To make it a little easier to describe, here...
  • Codepen Has Handy Sharing Tools for Devs
    There are plenty of online resources for playing around with code right in the browser, no server of your own needed, that you can then shar...
  • History of Eye-Tracking as Research Tool
    If you've ever wondered what eye-tracking is and where it came from, there is a historical breakdown in the article A Brief History of E...
  • Opera: Presto! It's now WebKit
    Opera is replacing its Presto rendering engine with WebKit (Chromium, really, when you factor in the V8 JavaScript rendering engine). Big n...
  • The Science of Trust in Social Media
    I am one of those people who always needs to see proof of some assertion, evidence to back up a claim. While I can accept anecdotal evidence...
  • Developer Discusses Dyslexia and Dyscalculia
    Sabrina Dent , a web designer hailing from Ireland, has blogged about her struggle with dyslexia and dyscalculia and web applications today...

Categories

  • accessibility
  • Adobe
  • analytics
  • Apple
  • apps
  • ARIA
  • Bing
  • Blink
  • Brightkite
  • browser
  • Buzz
  • Chrome
  • clients
  • css
  • design
  • Facebook
  • Firefox
  • Flash
  • fonts
  • food
  • Foursquare
  • g11n
  • geolocation
  • globalization
  • Google
  • Gowalla
  • html
  • i18n
  • ICANN
  • infographic
  • Instagram
  • internationalization
  • internet
  • Internet Explorer
  • JavaScript
  • JAWS
  • Klout
  • L10n
  • law
  • localization
  • Lynx
  • Mapquest
  • Microsoft
  • mobile
  • Netscape
  • ning
  • Opera
  • patents
  • picplz
  • Plus
  • print
  • privacy
  • project management
  • QR
  • rant
  • RSS
  • Safari
  • SCVNGR
  • search
  • SEM
  • SEO
  • social media
  • Sony
  • speaking
  • standards
  • SVG
  • touch
  • translation
  • Twitter
  • typefaces
  • usability
  • UX
  • Verizon
  • video
  • W3C
  • WAI
  • WCAG
  • WebKit
  • whatwg
  • Wired
  • WOFF
  • xhtml
  • Yahoo
  • YouTube

Blog Archive

  • ►  2013 (39)
    • ►  December (1)
    • ►  November (7)
    • ►  September (4)
    • ►  July (3)
    • ►  June (2)
    • ►  May (5)
    • ►  April (3)
    • ►  March (6)
    • ►  February (2)
    • ►  January (6)
  • ▼  2012 (63)
    • ►  December (2)
    • ►  November (4)
    • ►  October (5)
    • ►  September (5)
    • ►  August (4)
    • ►  July (6)
    • ▼  June (7)
      • Twitter Cards Are Now Valid HTML
      • Accessibility Bookmarklets and Tools
      • Another Anti-IE Gimmick
      • ICANN Announces Requested gTLDs
      • Image alt Exception Change Re-Re-Requested
      • Copying Content Styled with Text-Transform
      • Picplz Shutting Down, as Free Services Often Do
    • ►  May (7)
    • ►  April (8)
    • ►  March (5)
    • ►  February (3)
    • ►  January (7)
  • ►  2011 (67)
    • ►  December (5)
    • ►  November (7)
    • ►  October (5)
    • ►  September (4)
    • ►  August (8)
    • ►  July (3)
    • ►  June (8)
    • ►  May (3)
    • ►  April (1)
    • ►  March (6)
    • ►  February (6)
    • ►  January (11)
  • ►  2010 (100)
    • ►  December (8)
    • ►  November (7)
    • ►  October (5)
    • ►  September (10)
    • ►  August (7)
    • ►  July (11)
    • ►  June (12)
    • ►  May (6)
    • ►  April (8)
    • ►  March (10)
    • ►  February (5)
    • ►  January (11)
  • ►  2009 (51)
    • ►  December (9)
    • ►  November (6)
    • ►  October (21)
    • ►  September (13)
    • ►  August (2)
  • ►  2003 (3)
    • ►  October (1)
    • ►  January (2)
  • ►  2002 (9)
    • ►  December (1)
    • ►  June (3)
    • ►  April (1)
    • ►  March (3)
    • ►  January (1)
  • ►  2001 (1)
    • ►  February (1)
  • ►  2000 (4)
    • ►  October (1)
    • ►  July (1)
    • ►  June (1)
    • ►  January (1)
  • ►  1999 (7)
    • ►  November (1)
    • ►  September (2)
    • ►  August (2)
    • ►  July (1)
    • ►  June (1)
Powered by Blogger.

About Me

Unknown
View my complete profile