blob: 3875129ce83761f77019a2d65dc9a6f6faf5db0c (
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
|
<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="{{ site.BaseURL }}">
{{ end }}
<link rel="canonical" href="{{ .Permalink }}" itemprop="url" />
<!-- 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 }}
<meta name="description" content="{{ if .Params.description }}{{ .Params.description }}{{ else if .Site.Params.Description }}{{ .Site.Params.Description }}{{ end }}" />
{{ with site.Params.author }}
<meta name="author" content="{{ . }}">{{ end }}
{{ hugo.Generator }}
<!--Favicon-->
<link rel="shortcut icon" href="{{ site.Params.favicon | absURL }}" type="image/x-icon">
<link rel="icon" href="{{ site.Params.favicon | absURL }}" type="image/x-icon">
<!-- mobile responsive meta -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5">
<meta name="msapplication-TileColor" content="{{site.Params.variables.primary_color | default `#da532c`}}">
<meta name="theme-color" content="{{site.Params.variables.body_color | default `#ffffff` }}">
{{ "<!-- Open Graph image and Twitter Card metadata -->" | safeHTML }}
{{ $image_path := .Params.image | default site.Params.image -}}
{{ $image_path_local := printf "static/%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" . }}
{{ template "_internal/twitter_cards.html" . }}
<!-- google analytics -->
{{ template "_internal/google_analytics.html" . }}
|