Created
April 19, 2014 00:07
-
-
Save budparr/11069192 to your computer and use it in GitHub Desktop.
Jekyll Open Graph meta-data Generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- TODO: add og, twitter card --> | |
{% comment %} | |
http://ogp.me/ | |
{% endcomment %} | |
<meta name="description" content="{% if page.tagline %}{{page.tagline}}{% endif %}"> | |
{% if page.categories %} | |
{% for category in page.categories limit:1 %} | |
<meta content="{{ category }}" property="article:section"> | |
{% endfor %} | |
{% endif %} | |
{% if page.tags %} | |
{% for tag in page.tags %} | |
<meta content="{{ tag }}" property="article:tag"> | |
{% endfor %} | |
{% endif %} | |
<!-- Here’s the final snippet of code with the appropriate meta data: --> | |
<meta content="{{ site.title }}" property="og:site_name"> | |
{% if page.title %} | |
<meta content="{{ page.title }}" property="og:title"> | |
{% else %} | |
<meta content="{{ site.title }}" property="og:title"> | |
{% endif %} | |
{% if page.title %} | |
<meta content="article" property="og:type"> | |
{% else %} | |
<meta content="website" property="og:type"> | |
{% endif %} | |
{% if page.description %} | |
<meta content="{{ page.description }}" property="og:description"> | |
{% else %} | |
<meta content="{{ site.description }}" property="og:description"> | |
{% endif %} | |
{% if page.url %} | |
<meta content="{{site.baseurl}}{{ page.url }}" property="og:url"> | |
{% endif %} | |
{% if page.date %} | |
<meta content="{{ page.date | date_to_xmlschema }}" property="article:published_time"> | |
<meta content="{{site.baseurl}}/about/" property="article:author"> | |
{% endif %} | |
{% if page.image %} | |
<meta content="{{site.baseurl}}/assets/img/posts/{{ page.image }}" property="og:image"> | |
{% else %} | |
<meta content="{{site.baseurl}}/assets/img/logo-high-resolution.png" property="og:image"> | |
{% endif %} | |
{% if page.categories %} | |
{% for category in page.categories limit:1 %} | |
<meta content="{{ category }}" property="article:section"> | |
{% endfor %} | |
{% endif %} | |
{% if page.tags %} | |
{% for tag in page.tags %} | |
<meta content="{{ tag }}" property="article:tag"> | |
{% endfor %} | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment