15  Twitter cards

A Twitter card means than when a URL is included in a tweet, what other Twitter users see is not the URL but instead a “card”, i.e. the metadata from the URL rendered in a nice preview. The Twitter metadata in a post’s YAML helps it “look good” when an account like R Weekly Live or other readers link to the post in a tweet. The relevant YAML tags for rOpenSci posts are title, description, twitterImg, twitterAlt. These same metadata tags might be picked up by other platforms such as Slack.

If a specific description is not specified, the first sentences of the post (~100 characters) are used. If a specific twitterImg is not specified, a thumbnail of the rOpenSci logo is used. If you use twitterImg also use twitterAlt to provide alternative text for screenreader users.

This is what a tweet about an rOpenSci post looks like by default.

Example of tweet without twitterImg specified

This is what a tweet about an rOpenSci post looks like with YAML twitterImg specified.

Example of tweet with twitterImg specified

If you specify a twitterImg, ensure that its dimensions are appropriate. (Search for those in a search engine for current recommendation.) These may be different from the dimensions of an image featured in your post. You could save a separate copy of an image for the purpose of twitterImg only if you think it will draw people to read your post.

How do you know what it will look like? You can check the Twitter metadata by pasting a post’s preview link in the Twitter card validator. You might have to click the validator twice.