Skip to content

Commit

Permalink
adding open graph to head of site
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkersley committed Jan 5, 2016
1 parent fe67a39 commit 4c0e559
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
38 changes: 38 additions & 0 deletions _includes/head--opengraph.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<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.url }}{{ page.url }}" property="og:url">
{% endif %}
{% if page.date %}
<meta content="{{ page.date | date_to_xmlschema }}" property="article:published_time">
<meta content="{{ site.url }}" property="article:author">
{% endif %}
{% if page.image %}
<meta content="/img/{{ page.image }}" property="og:image">
{% else %}
<meta content="/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 %}
2 changes: 2 additions & 0 deletions _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@
<link rel="stylesheet" href="{{ "/css/main.css" | prepend: site.baseurl }}">
<link rel="canonical" href="{{ page.url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}">
<link rel="alternate" type="application/rss+xml" title="{{ site.title }}" href="{{ "/feed.xml" | prepend: site.baseurl | prepend: site.url }}">

{% include head--opengraph.html %}
</head>

0 comments on commit 4c0e559

Please sign in to comment.