Last active
March 20, 2025 09:04
-
-
Save JeremyMorgan/4970370 to your computer and use it in GitHub Desktop.
Some Liquid tags for adding in Opengraph data in your meta tags for Octopress
This file contains hidden or 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
{% if page.title %}<meta property="og:title" content="{{ page.title }}" /><meta itemprop="name" content="{{ page.title }}" />{% endif %} | |
{% if page.author %}<meta name="author" content="{{ site.author }}" /> | |
<meta property="article:author" content="https://plus.google.com/+JeremyMorgan" /> | |
<meta property="og:type" content="article" />{% endif %} | |
{% if page.date %}<meta property="article:published_time" content="{{ page.date }}" />{% endif %} | |
{% capture category %}{% if page.categories %}{{ page.categories }}{% endif %}{% endcapture %} | |
{% if page.categories %}<meta property="article:section" content="{{ page.categories }}" />{% endif %} | |
{% capture description %}{% if page.description %}{{ page.description }}{% else %}{{ content | raw_content }}{% endif %}{% endcapture %} | |
<meta name="description" content="{{ description | strip_html | condense_spaces | truncate:150 }}" /> | |
<meta property="og:description" content="{{ description | strip_html | condense_spaces | truncate:150 }}" /> | |
<meta itemprop="description" content="{{ description | strip_html | condense_spaces | truncate:150 }}" /> | |
{% if page.keywords %}<meta name="keywords" content="{{ page.keywords }}" />{% for keyword in page.keywords %}<meta property="article:tag" content="{{ keyword | replace: ',', '' }}" />{% endfor %}{% endif %} | |
{% if page.ogimage %}<meta property="og:image" content="{{ page.ogimage }}" /><meta itemprop="image" content="{{ page.ogimage }}" />{% endif %}<meta property="og:site_name" content="JeremyMorgan.com" /> | |
<!-- http://t.co/dKP3o1e --> | |
<meta name="HandheldFriendly" content="True" /> | |
<meta name="MobileOptimized" content="320" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1" /> | |
{% capture canonical %}{{ site.url }}{% if site.permalink contains '.html' %}{{ page.url }}{% else %}{{ page.url | remove:'index.html' }}{% endif %}{% endcapture %} | |
<meta property="og:url" content="{{ canonical }}" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment