cheatsheets/_includes/meta.html

86 lines
3.0 KiB
HTML

{% include 2017/meta-vars.html page=page %}
<meta charset='utf-8'>
<meta content='width=device-width, initial-scale=1.0' name='viewport'>
<link href='{{ base }}/assets/favicon.png' rel='shortcut icon'>
<meta content='{{ page.url | escape }}' name='app:pageurl'>
{% if meta_title %}
<title>{{ meta_title | escape }}</title>
<meta content='{{ meta_title | escape }}' property='og:title'>
<meta content='{{ meta_title | escape }}' property='twitter:title'>
<meta content='{{ page.og_type | default: "article" | escape }}' property='og:type'>
{% endif %}
{% if meta_image %}
<meta content='{{ meta_image | escape }}' property='og:image'>
<meta content='{{ meta_image | escape }}' property='twitter:image'>
<meta content='900' property='og:image:width'>
<meta content='471' property='og:image:height'>
{% endif %}
{% if meta_description %}
<meta content="{{ meta_description | escape }}" name="description">
<meta content="{{ meta_description | escape }}" property="og:description">
<meta content="{{ meta_description | escape }}" property="twitter:description">
{% endif %}
<link rel="canonical" href="{{ page_url | escape }}">
<meta name="og:url" content="{{ page_url | escape }}">
{% if page.url == '/' %}
<link rel="prefetch" href="{{ site.url | escape }}">
<link rel="prerender" href="{{ site.url | escape }}">
{% endif %}
{% if page.author %}
{% for author in site.authors | where: "name", page.author %}
<meta content='{{ author.name }}' name='author'>
{% if author.ogp %}
<meta content='{{ author.ogp }}' property='article:author'>
{% endif %}
{% endfor %}
{% endif %}
{% if site.title %}
<meta content='{{ site.title | escape }}' property='og:site_name'>
{% endif %}
{% if site.facebook.app_id %}
<meta content='{{ site.facebook.app_id | escape }}' property='fb:app_id'>
{% endif %}
{% if site.facebook.admin %}
<meta content='{{ site.facebook.admin | escape }}' property='fb:admins'>
{% endif %}
{% if page.date %}
<meta content='{{ page.date | date: "%Y-%m-%d" }}' property='article:published_date'>
{% endif %}
{% if page.category %}
<meta content='{{ page.category | escape }}' property='article:section'>
{% endif %}
{% if page.tags %}
{% for tag in page.tags %}
<meta content='{{ tag | escape }}' property='article:tag'>
{% endfor %}
{% endif %}
{% if site.data.google_analytics.enabled %}
<script async src='https://www.googletagmanager.com/gtag/js?id={{ site.data.google_analytics.id }}'></script>
<script>
{% comment %} if(~location.hostname.indexOf('{{site.data.google_analytics.hostname}}')){ {% endcomment %}
window.dataLayer=window.dataLayer||[];
function gtag(){dataLayer.push(arguments)};
gtag('js',new Date());
gtag('config','{{ site.data.google_analytics.id }}');
</script>
{% endif %}
{% if depth %}
<meta property='page:depth' content='{{depth}}'>
{% endif %}
<script>(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)</script>
<script>(function(H){H.className=H.className.replace(/\bNoJs\b/,'WithJs')})(document.documentElement)</script>