Skip to content

Instantly share code, notes, and snippets.

@apokusin
Last active June 14, 2017 07:15
Show Gist options
  • Select an option

  • Save apokusin/7922538 to your computer and use it in GitHub Desktop.

Select an option

Save apokusin/7922538 to your computer and use it in GitHub Desktop.
Social Meta tags with Jekyll
{% unless page.layout == 'error' %}
{% if page.layout == 'article' %}<meta name="description" content="{{ page.content | strip_html | xml_escape | truncate: 200 }}">{% endif %}
<meta property="og:title" content="{{ page.title }}"
/>
{% if page.layout == 'article' %}<meta property="og:description" content="{{ page.content | strip_html | xml_escape | truncate: 200 }}"
/>{% endif %}
<meta property="og:url" content="{{ site.blogURL }}{{ page.url }}" />
<meta property="og:image" content="{{ site.og_image }}"
/>
<meta property="og:site_name" content="{{ site.name }}"
/>
<meta property="fb:admins" content="{{ site.fb_admins }}" />
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@boltdotco">
{% if page.author %}
{% assign author = site.data.authors[page.author] %}
<meta name="twitter:creator" content="{{ author.twitter }}">
{% if page.date %}
<meta content="{{ page.date | date_to_xmlschema }}" property="article:published_time">
<meta content="{{ author.url }}" property="article:author">
{% endif %}
{% else %}
<meta property="og:type" content="website" />
{% endif %}
{% if page.title %}<meta name="twitter:title" content="{{ page.title }}">{% else %}<meta name="twitter:title" content="{{ site.title }}">{% endif %}
{% if page.url %}<meta name="twitter:url" content="{{ site.blogURL }}{{ page.url }}">{% endif %}
{% if page.layout == 'article' %}<meta name="twitter:description" content="{{ page.content | strip_html | xml_escape | truncate: 200 }}">{% endif %}
<meta name="twitter:image:src" content="{{ site.og_image }}">
{% endunless %}
<meta content='yes' name='apple-mobile-web-app-capable'>
<meta content='black' name='apple-mobile-web-app-status-bar-style'>
<meta content='Bolt Blog' name='apple-mobile-web-app-title'>
@Globik
Copy link
Copy Markdown

Globik commented Jun 14, 2017

With no layout support?

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