Welcome to mirror list, hosted at ThFree Co, Russian Federation.

head.html « partials « layouts - github.com/themefisher/airspace-hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9a7cabe261d17fa3635127b5fd57e60b100c381a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<meta charset="utf-8">
<title>{{.Title | default site.Title}}</title>

<!-- base url -->
{{ if or (eq site.BaseURL "/") (eq site.BaseURL "http://localhost:1313/") (eq site.BaseURL "http://examplesite.org/") (eq site.BaseURL "https://examplesite.org/") (eq site.BaseURL "http://examplesite.com/") (eq site.BaseURL "https://examplesite.com/")}}{{else}}
<base href="{{ .Permalink }}">
{{ end }}

<!-- multilingual SEO optimizations -->
{{ if .IsTranslated }}
{{ range .AllTranslations }}
<link rel="alternate" hreflang="{{.Lang}}" href="{{ .RelPermalink | absLangURL }}">
{{ end }}
<link rel="alternate" hreflang="x-default" href="{{ .RelPermalink | absLangURL }}">
{{ end }}

<!-- mobile responsive meta -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5">
<meta name="description" content="{{ .Params.Description | default site.Params.description }}">
{{ with site.Params.author }}
<meta name="author" content="{{ . }}">{{ end }}
{{ hugo.Generator }}

<!-- google site verification -->
{{ with site.Params.site_verification.google }}
<meta name="google-site-verification" content="{{ . }}" />
{{ end }}

<!-- bing site verification -->
{{ with site.Params.site_verification.bing }}
<meta name="msvalidate.01" content="{{ . }}" />
{{ end }}

<!-- baidu site verification -->
{{ with site.Params.site_verification.baidu }}
<meta name="baidu-site-verification" content="{{ . }}" />
{{ end }}

<!-- favicon -->
{{ $favicon:= site.Params.favicon }}
{{ if $favicon }}
{{ if fileExists (add `assets/` $favicon) }}
{{ $favicon:= resources.Get $favicon }}
{{ $favicon_16:= $favicon.Resize "16x png"}}
{{ $favicon_32:= $favicon.Resize "32x png"}}
{{ $favicon_180:= $favicon.Resize "180x png"}}
<link rel="shortcut icon" href="{{$favicon_32.RelPermalink}}" type="image/x-icon">
<link rel="icon" href="{{$favicon_32.RelPermalink}}" type="image/x-icon">
<link rel="icon" type="image/png" sizes="16x16" href="{{$favicon_16.RelPermalink}}">
<link rel="icon" type="image/png" sizes="32x32" href="{{$favicon_32.RelPermalink}}">
<link rel="apple-touch-icon" sizes="180x180" href="{{$favicon_180.RelPermalink}}">
{{ end }}
{{ end }}
<link rel="manifest" href="{{`manifest.webmanifest` | relLangURL }}">
<meta name="msapplication-TileColor" content="{{site.Params.variables.color_primary | default `#da532c`}}">
<meta name="theme-color" content="{{site.Params.variables.body_color | default `#ffffff` }}">


<!-- Open Graph image and Twitter Card meta-data -->
{{ $image_path := .Params.image | default site.Params.image }}
{{ $image_path_local :=  printf "assets/%s" $image_path }}
{{ $image_ext := trim (path.Ext $image_path | lower) "." }}
{{ if fileExists $image_path_local }}
<meta property="og:image" content="{{ $image_path | absURL }}" />
<!-- If not SVG, read image aspect ratio and define Twitter Card and Open Graph width and height  -->
{{ if ne $image_ext "svg" }}
{{ with (imageConfig $image_path_local) }}
{{ if (and (gt .Width 144) (gt .Height 144)) }}
<meta name="twitter:image" content="{{ $image_path | absURL }}" />
<meta name="twitter:card"
  content="summary{{ if (and (gt .Width 300) (gt .Height 157) (not (eq .Width .Height))) }}_large_image{{ end }}">
{{ end }}
<meta property="og:image:width" content="{{ .Width }}">
<meta property="og:image:height" content="{{ .Height }}">
{{ end }}
{{ end }}
<meta property="og:image:type"
  content="image/{{ if eq $image_ext `svg` }}svg+xml{{ else }}{{ replaceRE `^jpg$` `jpeg` $image_ext }}{{ end }}">
{{ end }}
<meta name="twitter:title" content="{{ with .Title }}{{ . }}{{ else }}{{ site.Title }}{{ end }}" />
<meta name="twitter:description"
  content="{{ with .Description }}{{ . }}{{ else }}{{ if .IsPage }}{{ .Summary }}{{ else }}{{ with site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" />
{{ with site.Social.twitter }}
<meta name="twitter:site" content="@{{ . }}" />{{ end }}
{{ range site.Authors }}
{{ with .twitter }}
<meta name="twitter:creator" content="@{{ . }}" />{{ end }}
{{ end }}

{{ template "_internal/opengraph.html" . }}

<!-- google analytics -->
{{ template "_internal/google_analytics.html" . }}

<!-- google tag manager -->
{{ with site.Params.google_tag_manager }}
<script>
  var dataLayer = window.dataLayer = window.dataLayer || [];
  dataLayer.push({
    page: '{{ .Title }}',
    categories: 'only examples about your dataLayer'
  });
</script>
<script>
  (function (w, d, s, l, i) {
    w[l] = w[l] || [];
    w[l].push({
      'gtm.start': new Date().getTime(),
      event: 'gtm.js'
    });
    var f = d.getElementsByTagName(s)[0],
      j = d.createElement(s),
      dl = l != 'dataLayer' ? '&l=' + l : '';
    j.async = true;
    j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
    f.parentNode.insertBefore(j, f);
  })(window, document, 'script', 'dataLayer', '{{ . }}');
</script>
{{ end }}

<!-- matomo analytics -->
{{ with site.Params.matomo }}
{{ if .enable }}
<script type="text/javascript">
  var _paq = window._paq = window._paq || [];
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function () {
    var u = "{{.url|safeURL}}";
    _paq.push(['setTrackerUrl', u + 'matomo.php']);
    _paq.push(['setSiteId', '{{.id}}']);
    var d = document,
      g = d.createElement('script'),
      s = d.getElementsByTagName('script')[0];
    g.type = 'text/javascript';
    g.async = true;
    g.src = u + 'matomo.js';
    s.parentNode.insertBefore(g, s);
  })();
</script>
{{ end }}
{{ end }}

<!--  Baidu analytics -->
{{ if site.Params.baidu.enable }}
{{ with site.Params.baidu.analytics_id }}
<script>
  var _hmt = _hmt || [];
  (function () {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?{{ . }}";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
  })();
</script>
{{ end }}
{{ end }}

<!-- Plausible Analytics -->
{{ if site.Params.plausible.enable }}
{{ with site.Params.plausible.domain }}
<script defer data-domain="{{ . }}" src="https://plausible.io/js/plausible.js"></script>
{{ end }}
{{ end }}

<!-- Counter Analytics -->
{{ with site.Params.counter }}
{{ if .enable }}
{{ with .username }}
<script>
  if(!sessionStorage.getItem("_swa")&&document.referrer.indexOf(location.protocol+"//"+location.host)!== 0){fetch("https://counter.dev/track?"+new URLSearchParams({referrer:document.referrer,screen:screen.width+"x"+screen.height,user:"{{ . }}",utcoffset:"0"}))};sessionStorage.setItem("_swa","1");
</script>
{{ end }}
{{ end }}
{{ end }}

<!-- Google reCaptcha -->
{{ if site.Params.contact.form.use_recaptcha }}
<script src="https://www.google.com/recaptcha/api.js?render={{ site.Params.recaptcha_site_key }}"></script>
<script>
  grecaptcha.ready(function() {
      grecaptcha.execute('{{ site.Params.recaptcha_site_key }}', {action: 'homepage'})
      .then(function(token) {
        document.getElementById('captchaResponse').value = token;
      });
    });
</script>
{{ end }}