Skip to content

Instantly share code, notes, and snippets.

@vinayprajapati
Last active January 7, 2017 02:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vinayprajapati/5900461 to your computer and use it in GitHub Desktop.
Save vinayprajapati/5900461 to your computer and use it in GitHub Desktop.
Open Graph Protocol/ Meta Tags/ Micro Data for Blogger
// Turn <head> tag like this -
<head prefix='og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# article: http://ogp.me/ns/article#'>
// Then just below this add this code -
// Copyright (c) 2013, Vinay Prajapati, Tech Prevue Labs, India
// http://www.techprevue.com
<b:if cond='data:blog.pageType != &quot;index&quot;'>
<meta expr:content='data:blog.title' property='og:site_name'/>
<meta expr:content='data:blog.pageName' property='og:title'/>
<meta content='article' property='og:type'/>
<b:else/>
<meta expr:content='data:blog.title' property='og:title'/>
<meta content='blog' property='og:type'/>
</b:if>
<meta expr:content='data:blog.metaDescription' property='og:description'/>
<meta expr:content='data:blog.canonicalUrl' property='og:url'/>
<b:if cond='data:blog.postImageThumbnailUrl'>
<meta expr:content='data:blog.postImageThumbnailUrl' itemprop='image'/>
<b:else/>
<meta content='http://blog-img-url' property='og:image'/>
</b:if>
<meta content='1020412247' property='fb:admins'/>
<meta content='348446671899960' property='fb:app_id'/>
<meta content='214801001979659' property='fb:page_id'/>
<meta content='en_US' property='og:locale'/>
<meta content='en_GB' property='og:locale:alternate'/>
<meta content='hi_IN' property='og:locale:alternate'/>
@vinayprajapati
Copy link
Author

Some values to change -

  1. Line 21 - "http://blog-img-url" url should be used as per your blog logo; square size is best.
  2. Line 23, 24 25 - Facebook admin id, app id, and page id may added in which values are 1020412247, 348446671899960, 214801001979659 respectively
  3. Line 26 - If you are not a English US blogger then then en_US should be changed with your og:locale
  4. Line 27, 28 - Alternate og:locale may be added, which are currently en_GB and hi_IN respectively. You may delete these lines.

@SidVal
Copy link

SidVal commented Jan 7, 2017

I do not remember where I read it, but I think today you don't need to add "fb:admins" property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment