Skip to content

Instantly share code, notes, and snippets.

@thomasthesecond
Created June 27, 2015 16:13
Show Gist options
  • Save thomasthesecond/948147a7dbd9ee972146 to your computer and use it in GitHub Desktop.
Save thomasthesecond/948147a7dbd9ee972146 to your computer and use it in GitHub Desktop.
{% extends '_layouts/default' %}
{% set meta = {
title: entry.title,
url: entry.url,
description: entry.description|default(entry.body),
keywords: entry.keywords,
image: entry.image.first().url
} %}
{% block content %}
<h1>{{ entry.title }}</h1>
{{ entry.body }}
{% endblock %}
<!doctype html>
<html class="no-js" lang="en-US" itemscope itemtype="http://schema.org/WebSite">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
{% include '_meta' %}
</head>
<body>
<main id="main" role="main" tabindex="0">
{% block content %}
{% endblock %}
</main>
</body>
</html>
{# Meta Variables #}
{% set defaultMeta = {
title: '',
url: '',
description: '',
keywords: '',
image: ''
} %}
{% set meta = meta is defined ? defaultMeta|merge(meta) : defaultMeta %}
{# Global Variables #}
{% set global = {
name: siteName,
description: seo.metaDescription,
keywords: seo.metaKeywords,
image: social.shareImage.first().url,
publisher: social.googleUrl,
creator: social.twitterHandle,
separator: craft.request.firstSegment ? ' - ' : ''
} %}
{# Title #}
<title>{{ meta.title }}{{ global.separator }}{{ global.name }}</title>
{# Meta Description and Keywords #}
<meta name="description" content="{{ meta.description|default(global.description) }}">
<meta name="keywords" content="{{ meta.keywords|default(global.keywords) }}">
{# Canonical URL #}
<link rel="canonical" href="{{ meta.url }}">
{# Schema / Microdata #}
<meta itemprop="name" content="{{ global.name }}">
<meta itemprop="description" content="{{ global.description }}">
<meta itemprop="image" content="{{ global.image }}">
{# Twitter #}
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@{{ global.creator }}">
<meta name="twitter:creator" content="@{{ global.creator }}">
{# Open Graph #}
<meta property="og:site_name" content="{{ global.name }}">
<meta property="og:type" content="website">
<meta property="og:title" content="{{ meta.title }}">
<meta property="og:url" content="{{ meta.url }}">
<meta property="og:description" content="{{ meta.description|default(global.description) }}">
<meta property="og:image" content="{{ meta.image|default(global.image) }}">
{# Google+ #}
<link rel="publisher" href="{{ global.publisher }}">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment