Skip to content

Instantly share code, notes, and snippets.

@pathawks pathawks/meta.html
Last active Dec 19, 2018

Embed
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

This comment has been minimized.

Copy link

incheon commented Jan 10, 2015

nice hack 👍

@akmil

This comment has been minimized.

Copy link

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
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.