AMPERION_Webpage/layouts/partials/head.html

70 lines
3 KiB
HTML
Raw Permalink Normal View History

2025-06-06 18:12:46 +02:00
<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 }}
<!-- theme meta -->
<meta name="theme-name" content="airspace-hugo" />
<!-- 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 }}
{{ end }}
{{ template "_internal/opengraph.html" . }}