Skip to content

Instantly share code, notes, and snippets.

@roelven
Forked from pathawks/meta.html
Created October 24, 2012 23:36
Show Gist options
  • Save roelven/3949615 to your computer and use it in GitHub Desktop.
Save roelven/3949615 to your computer and use it in GitHub Desktop.
Open Graph for Jekyll
{% capture header %}
{% if page.title %}
<meta property="og:type" content="article" />
<meta property="og:title" content="{{ page.title }} – {{ site.title }}" />
{% if page.url %}
<meta property="og:url" content="{{ site.url }}{{ page.url }}" />
{% endif %}
{% else %}
<meta property="og:type" content="website" />
<meta property="og:url" content="{{ site.url }}" />
{% endif %}
{% if site.title %}
<meta property="og:site_name" content="{{ site.title }}" />
{% endif %}
{% capture description %}{% if page.description %}{{ page.description }}{% else %}{{ content | raw_content }}{% endif %}{% endcapture %}
<meta property="og:description" content="{{ description | strip_html | condense_spaces | truncate:150 }}" />
{% if page.date %}
<meta property="article:published_time" content="{{page.date | date_to_xmlschema}}" />
{% endif %}
{% if site.owner_link %}
<meta property="article:author" content="{{ site.owner_link }}" />
{% endif %}
{% endcapture %}{{ header | strip_newlines }}
<meta property="og:locale" content="en_us" />
<meta property="fb:admins" content="[FB_ADMIN]" />
<meta property="og:image" content="" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment