Create a gist now

Instantly share code, notes, and snippets.

@pathawks /meta.html
Last active Apr 15, 2017

What would you like to do?
Open Graph for Jekyll
{% if include.content %}
<meta property="{{ include.property }}" content="{{ include.content }}" />
{% endif %}
{% capture header %}
{% if page.title %}
<meta property="og:type" content="article" />
<meta property="og:title" content="{{ page.title }}" />
{% else %}
<meta property="og:type" content="website" />
{% endif %}
{% include meta.html property="og:site_name" content=site.title %}
{% include meta.html property="og:image" content=page.thumbnail %}
{% capture page_url %}{{ page.url | replace:'/index.html','/' | append: site.url | append: site.baseurl }}{% endcapture %}
{% include meta.html property="og:url" content=page_url %}
{% capture page_date %}{{page.date | date_to_xmlschema}}{% endcapture %}
{% include meta.html property="article:published_time" content=page_date %}
{% if page.author.url %}
<meta property="article:author" content="{{ page.author.url }}" />
<link rel="author" href="{{ page.author.url }}" />
{% elsif site.owner_link %}
<meta property="article:author" content="{{ site.owner_link }}" />
<link rel="author" href="{{ site.owner_link }}" />
{% endif %}
{% endcapture %}{{ header | strip_newlines }}
@incheon
incheon commented Jan 10, 2015

nice hack 👍

@akmil
akmil commented Feb 1, 2017

maybe it would be better to use 'jekyll-seo-tag' plugin?

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