Instantly share code, notes, and snippets.

@Blumed /head.html Secret
Created Jan 19, 2016

Embed
What would you like to do?
Jekyll head logic for meta tags
<!-- Schema.org markup for Google+ -->
{% if page.title %}
<meta itemprop="name" content="{{ page.title }}">
{% else %}
<meta itemprop="name" content="{{ site.title }}">
{% endif %}
{% if page.description %}
<meta itemprop="description" content="{{ page.description }}">
{% else %}
<meta itemprop="description" content="{{ site.description }}">
{% endif %}
{% if page.image %}
<meta itemprop="image" content="{{ site.url }}/assets/images/social/og/{{ page.image }}.jpg">
{% else %}
<meta itemprop="image" content="{{ site.url }}/assets/og.jpg">
{% endif %}
<!-- Twitter Card data -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@CullanLuther">
{% if page.title %}
<meta name="twitter:title" content="{{ page.title }}">
{% else %}
<meta name="twitter:title" content="{{ site.title }}">
{% endif %}
{% if page.description %}
<meta name="twitter:description" content="{{ page.description }}">
{% else %}
<meta name="twitter:description" content="{{ site.description }}">
{% endif %}
<meta name="twitter:creator" content="@CullanLuther">
<!-- Twitter summary card with large image must be at least 280 x 150 -->
{% if page.image %}
<meta name="twitter:image:src" content="{{ site.url }}/assets/images/social/twitter/{{ page.image }}.jpg">
{% else %}
<meta name="twitter:image:src" content="{{ site.url }}/assets/images/og.jpg">
{% endif %}
<!-- Open Graph -->
<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 }}about/" property="article:author">
{% endif %}
<!-- Facebook summary card with large image must be at least 1200 x 630 -->
{% if page.image %}
<meta content="{{ site.url }}/assets/images/social/og/{{ page.image }}.jpg" property="og:image">
{% else %}
<meta content="{{ site.url }}/assets/images/og.jpg" 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