Twitter recently announced support for "Twitter Cards", a simple way to annotate your content so Twitter apps can provide content previews or inline viewing of media from with the Twitter timeline. For example, if I added the following metadata to one of my blog posts:
<!-- start of Twitter Summary Card --> <meta name="twitter:card" content="summary"> <meta name="twitter:title" content="The Wiki is in French..."> <meta name="twitter:description" content="A few years ago, I was managing a team that, among other things, was responsible for the administration of our internal tools, including the company's wiki. One day, while in a meeting, my phone st..."> <meta name="twitter:site" content="@igb"> <meta name="twitter:creator" content="@igb"> <!-- end of Twitter Summary Card -->then any tweet that contained a link to that post would (in Twitter apps or sites) would let you see a preview or "summary" of that page in the timeline directly:
usage: TwitterSummaryCardGenerator.py [-h] [-t TWITTERID] (-f FILE | -r RSSFEED) [-d OUTPUTDIR] optional arguments: -h, --help show this help message and exit -t TWITTERID, --twitterid TWITTERID your Twitter user name, without the '@' -f FILE, --file FILE local file to summarize and add card data to -r RSSFEED, --rssfeed RSSFEED url of RSS feed to download and summarize -d OUTPUTDIR, --outputdir OUTPUTDIR output directory for to write file(s) with summary
> python2.7 src/python/TwitterSummaryCardGenerator.py -t igb -r "http://www.hccp.org/rss.xml" -d /tmp/
Reads the local file, generates a summary from the first 200 non-markup characters of the body, and then inserts a card summary into the head of the document, writing a document out (with the same name as the source) in the provided directory.
Example:
> python2.7 src/python/TwitterSummaryCardGenerator.py -t igb -f ../hccp/blog.html -d /tmp/
Disclaimer: at the time I wrote this post, I was employed by Twitter. To be clear, the information and opinions here are mine and mine alone. In no way do they reflect the opinions, direction, etc. of Twitter. Cheers!