Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save inslayn/95f57ce26c566c52b3424f66733aabcf to your computer and use it in GitHub Desktop.
Save inslayn/95f57ce26c566c52b3424f66733aabcf to your computer and use it in GitHub Desktop.
{{! 1. If we have a featured image, use the Summary Card with Large Image type }}
{{! If we don't have a featured image, use the Summary Card type }}
<meta name="twitter:card" content={{#if image}}"summary_large_image"{{else}}"summary"{{/if}}>
{{! 2. Don't forget to update the attribution links. }}
<meta name="twitter:site" content="@nytimes">
<meta name="twitter:creator" content="@SarahMaslinNir">
{{! 3. We set the content to the post's title, using the Handlebars tag }}
<meta name="twitter:title" content="{{{title}}}">
{{! 4. We set the content to an excerpt of the post's content, of a maximum of 26 words, using the Handlebars tag, followed by an ellipsis. }}
<meta name="twitter:description" content="{{excerpt words="26"}} &hellip;">
{{! 5. We set the content to the post's featured image if we have one, otherwise we use the blog's logo instead }}
<meta name="twitter:image" content={{#if image}}"{{image}}"{{else}}"{{@blog.logo}}"{{/if}}>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment