OSDN Git Service

Regular updates
[twpd/master.git] / _includes / meta.html
1 {% include 2017/meta-vars.html page=page %}
2 <meta charset='utf-8'>
3 <meta content='width=device-width, initial-scale=1.0' name='viewport'>
4 <link href='{{ base }}/assets/favicon.png' rel='shortcut icon'>
5 <meta content='{{ page.url | escape }}' name='app:pageurl'>
6
7 {% if meta_title %}
8   <title>{{ meta_title | escape }}</title>
9   <meta content='{{ meta_title | escape }}' property='og:title'>
10   <meta content='{{ meta_title | escape }}' property='twitter:title'>
11   <meta content='{{ page.og_type | default: "article" | escape }}' property='og:type'>
12 {% endif %}
13
14 {% if meta_image %}
15   <meta content='{{ meta_image | escape }}' property='og:image'>
16   <meta content='{{ meta_image | escape }}' property='twitter:image'>
17   <meta content='900' property='og:image:width'>
18   <meta content='471' property='og:image:height'>
19 {% endif %}
20
21 {% if meta_description %}
22   <meta content="{{ meta_description | escape }}" name="description">
23   <meta content="{{ meta_description | escape }}" property="og:description">
24   <meta content="{{ meta_description | escape }}" property="twitter:description">
25 {% endif %}
26
27 <link rel="canonical" href="{{ page_url | escape }}">
28 <meta name="og:url" content="{{ page_url | escape }}">
29 {% if page.url == '/' %}
30   <link rel="prefetch" href="{{ site.url | escape }}">
31   <link rel="prerender" href="{{ site.url | escape }}">
32 {% endif %}
33
34 {% if page.author %}
35 {% for author in site.authors | where: "name", page.author %}
36   <meta content='{{ author.name }}' name='author'>
37   {% if author.ogp %}
38   <meta content='{{ author.ogp }}' property='article:author'>
39   {% endif %}
40 {% endfor %}
41 {% endif %}
42
43 {% if site.title %}
44   <meta content='{{ site.title | escape }}' property='og:site_name'>
45 {% endif %}
46
47 {% if site.facebook.app_id %}
48   <meta content='{{ site.facebook.app_id | escape }}' property='fb:app_id'>
49 {% endif %}
50
51 {% if site.facebook.admin %}
52   <meta content='{{ site.facebook.admin | escape }}' property='fb:admins'>
53 {% endif %}
54
55 {% if page.date %}
56   <meta content='{{ page.date | date: "%Y-%m-%d" }}' property='article:published_date'>
57 {% endif %}
58
59 {% if page.category %}
60   <meta content='{{ page.category | escape }}' property='article:section'>
61 {% endif %}
62
63 {% if page.tags %}
64 {% for tag in page.tags %}
65   <meta content='{{ tag | escape }}' property='article:tag'>
66 {% endfor %}
67 {% endif %}
68
69 {% if site.data.google_analytics.enabled %}
70 <script async src='https://www.googletagmanager.com/gtag/js?id={{ site.data.google_analytics.id }}'></script>
71 <script>
72 {% comment %} if(~location.hostname.indexOf('{{site.data.google_analytics.hostname}}')){ {% endcomment %}
73 window.dataLayer=window.dataLayer||[];
74 function gtag(){dataLayer.push(arguments)};
75 gtag('js',new Date());
76 gtag('config','{{ site.data.google_analytics.id }}');
77 </script>
78 {% endif %}
79
80 {% if depth %}
81   <meta property='page:depth' content='{{depth}}'>
82 {% endif %}
83
84 <script>(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)</script>
85 <script>(function(H){H.className=H.className.replace(/\bNoJs\b/,'WithJs')})(document.documentElement)</script>