71 lines
3.7 KiB
HTML
71 lines
3.7 KiB
HTML
<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 }}
|
|
|
|
<!-- 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 }}
|
|
|
|
<!-- favicon -->
|
|
{{ $favicon:= site.Params.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 }}
|
|
<link rel="manifest" href="{{`manifest.webmanifest` | relURL }}">
|
|
<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" . }} |