Skip to content

Instantly share code, notes, and snippets.

@ianlewis
Created January 24, 2014 08:55
Show Gist options
  • Save ianlewis/8594165 to your computer and use it in GitHub Desktop.
Save ianlewis/8594165 to your computer and use it in GitHub Desktop.
Twitter Card/Open Graph support for Blogger ref: http://qiita.com/IanMLewis/items/375d5c1d19c164de340f
<!-- Begin Open Graph metadata -->
<meta content='summary' name='twitter:card'/>
<meta content='@<your twitter account>' name='twitter:site'/>
<b:if cond='data:blog.metaDescription'>
<meta expr:content='data:blog.metaDescription' name='og:description'/>
<b:else/>
<!-- Twitter Cards require a description but blogger posts don't always have one -->
<meta content='<Default Post Description>' name='og:description'/>
</b:if>
<b:if cond='data:blog.pageType == &quot;item&quot;'>
<!-- For the individual blog post page -->
<meta content='article' property='og:type'/>
<meta expr:content='data:blog.title' property='og:site_name'/>
<meta expr:content='data:blog.pageName' property='og:title'/>
<b:if cond='data:blog.postImageThumbnailUrl'>
<meta expr:content='data:blog.postImageThumbnailUrl' property='og:image'/>
</b:if>
<b:else/>
<!-- Index, search etc. -->
<meta expr:content='data:blog.title' property='og:title'/>
<meta content='website' property='og:type'/>
<meta content='<Default image url here>' property='og:image'/>
</b:if>
<meta expr:content='&quot;<your locale>&quot;' property='og:locale'/>
<meta expr:content='data:blog.canonicalUrl' property='og:url'/>
<!-- End Open Graph metadata -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment