<commit_before>---
title: "Integrating social meta tags into Jekyll"
date: 2015-02-11T13:04:19+05:45
date_modified: 2015-03-17T13:45:58+05:45
excerpt: "A guide to adding social meta tags into Jekyll."
---

Social media meta tags allows us to optimize for sharing Twitter, Facebook, Google+ and Pinerest by defining exactly how titles, descriptions, images and more appear in social streams. There're various ways but following social meta tags is the best method to integrating into Jekyll.

A lot of these will even cross-share the tags. For example, Google+ will actually use Facebook's Open Graph tags if their available. All in all, the following code is a great start.

### Integrating Open Graph into Jekyll

{% highlight html %}
{% raw %}
<meta property="og:title" content="{% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}">
<meta property="og:type" content="{% if page.date %}article{% else %}website{% endif %}">
<meta property="og:url" content="{{ page.url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}">
<meta property="og:image" content="{% if page.image %}{{ page.image | prepend: site.baseurl | prepend: site.url }}{% else %}{{ site.icon | prepend: site.baseurl | prepend: site.url }}{% endif %}">
<meta property="og:description" content="{% if page.excerpt %}{{ page.excerpt | strip_html | strip_newlines | truncate: 160 }}{% else %}{{ site.description }}{% endif %}">
<meta property="og:site_name" content="{{ site.title }}">
<meta property="og:locale" content="{{ site.locale }}">

{% if page.date_modified %}
  <meta property="article:modified_time" content="{{ page.date_modified | date_to_xmlschema }}
{% endif %}">

{% if page.date %}
  <meta property="article:published_time" content="{{ page.date | date_to_xmlschema }}">
  <meta property="article:author" content="https://www.facebook.com/{{ site.author.facebook }}">
  {% for post in site.related_posts limit:3 %}
    <meta property="og:see_also" content="{{ post.url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}">
  {% endfor %}
{% endif %}
<commit_msg>Corrected Liquid tag code<commit_after>---
title: "Integrating social meta tags into Jekyll"
date: 2015-02-11T13:04:19+05:45
date_modified: 2015-03-17T22:35:36+05:45
excerpt: "A guide to adding social meta tags into Jekyll."
---

Social media meta tags allows us to optimize for sharing Twitter, Facebook, Google+ and Pinerest by defining exactly how titles, descriptions, images and more appear in social streams. There're various ways but following social meta tags is the best method to integrating into Jekyll.

A lot of these will even cross-share the tags. For example, Google+ will actually use Facebook's Open Graph tags if their available. All in all, the following code is a great start.

### Integrating Open Graph into Jekyll

{% highlight html %}
{% raw %}
<meta property="og:title" content="{% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}">
<meta property="og:type" content="{% if page.date %}article{% else %}website{% endif %}">
<meta property="og:url" content="{{ page.url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}">
<meta property="og:image" content="{% if page.image %}{{ page.image | prepend: site.baseurl | prepend: site.url }}{% else %}{{ site.icon | prepend: site.baseurl | prepend: site.url }}{% endif %}">
<meta property="og:description" content="{% if page.excerpt %}{{ page.excerpt | strip_html | strip_newlines | truncate: 160 }}{% else %}{{ site.description }}{% endif %}">
<meta property="og:site_name" content="{{ site.title }}">
<meta property="og:locale" content="{{ site.locale }}">

{% if page.date_modified %}
  <meta property="article:modified_time" content="{{ page.date_modified | date_to_xmlschema }}">
{% endif %}

{% if page.date %}
  <meta property="article:published_time" content="{{ page.date | date_to_xmlschema }}">
  <meta property="article:author" content="https://www.facebook.com/{{ site.author.facebook }}">
  {% for post in site.related_posts limit:3 %}
    <meta property="og:see_also" content="{{ post.url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}">
  {% endfor %}
{% endif %}

{'fraction_non_alphanumeric': 0.16745506149479658, 'fraction_numerical': 0.01892147587511826, 'mean_word_length': 5.274480712166172, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1372833', 'n_tokens_mistral': 1410, 'n_tokens_neox': 1268, 'n_words': 415}