Skip to content

Instantly share code, notes, and snippets.

@zillingen
Last active April 9, 2018 18:40
Show Gist options
  • Save zillingen/9c6d33d09f4d915a088aab6c50c8cb43 to your computer and use it in GitHub Desktop.
Save zillingen/9c6d33d09f4d915a088aab6c50c8cb43 to your computer and use it in GitHub Desktop.
Twig markup for Open Graph and other SEO tags
{# Open Graph #}
<meta property="og:title" content="{{ page.title }}" />
<meta property="og:type" content="{{ isArticle ? 'article' : 'website' }}" />
<meta property="og:url" content="{{ page.url }}" />
<meta property="og:image" content="{{ page.image }}" />
<meta property="og:description" content="{{ page.description }}" />
{% if isArticle is true %}
<meta property="article:published_time" content="{{ page.publishedAt }}" />
<meta property="article:modified_time" content="{{ page.modifiedAt }}" />
<meta property="article:author" content="{{ page.author }}" />
<meta property="article:section" content="{{ page.category }}" />
{% for tag in page.tags %}
<meta property="article:tag" content="{{ tag }}" />
{% endfor %}
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment