73 lines
3.2 KiB
HTML
73 lines
3.2 KiB
HTML
{{- /* head-seo.html — <title>, meta description, canonical, Open Graph, Twitter,
|
|
RSS alternate, and JSON-LD (delegated to schema-jsonld.html). All values
|
|
fall back sensibly to brand data. */ -}}
|
|
{{- $brand := .Site.Data.brand -}}
|
|
|
|
{{- $title := "" -}}
|
|
{{- if .IsHome -}}
|
|
{{- $title = .Params.title | default (printf "%s | %s" $brand.name $brand.tagline) -}}
|
|
{{- else -}}
|
|
{{- $title = printf "%s | %s" (.Params.title | default .Title) $brand.name -}}
|
|
{{- end -}}
|
|
|
|
{{- $desc := "" -}}
|
|
{{- with .Params.description -}}
|
|
{{- $desc = . -}}
|
|
{{- else -}}
|
|
{{- $desc = .Summary | default .Site.Params.defaultDescription -}}
|
|
{{- end -}}
|
|
{{- $desc = $desc | plainify | chomp | truncate 160 -}}
|
|
|
|
{{- /* Per-page OG image override (.Params.image) with fallback to the site default. */ -}}
|
|
{{- $ogImage := (.Params.image | default .Site.Params.ogImage) | absURL -}}
|
|
|
|
<title>{{ $title }}</title>
|
|
<meta name="description" content="{{ $desc }}">
|
|
<link rel="canonical" href="{{ .Permalink }}">
|
|
<meta name="robots" content="{{ if .Params.noindex }}noindex,nofollow{{ else }}index,follow{{ end }}">
|
|
<meta name="author" content="{{ $brand.name }}">
|
|
|
|
{{- /* Open Graph */ -}}
|
|
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}">
|
|
<meta property="og:title" content="{{ $title }}">
|
|
<meta property="og:description" content="{{ $desc }}">
|
|
<meta property="og:url" content="{{ .Permalink }}">
|
|
<meta property="og:site_name" content="{{ $brand.name }}">
|
|
<meta property="og:locale" content="{{ replace (.Language.LanguageCode | default .Language.Lang) "-" "_" }}">
|
|
<meta property="og:image" content="{{ $ogImage }}">
|
|
<meta property="og:image:width" content="1200">
|
|
<meta property="og:image:height" content="630">
|
|
|
|
{{- /* Twitter */ -}}
|
|
<meta name="twitter:card" content="summary_large_image">
|
|
<meta name="twitter:title" content="{{ $title }}">
|
|
<meta name="twitter:description" content="{{ $desc }}">
|
|
<meta name="twitter:image" content="{{ $ogImage }}">
|
|
|
|
{{- /* hreflang alternates for the multilingual build. No-op on single-language
|
|
sites (.IsTranslated is false), so it is safe to keep permanently. URL
|
|
scheme: defaultContentLanguageInSubdir = false (English at root). */ -}}
|
|
{{- if .IsTranslated -}}
|
|
{{- range .AllTranslations -}}
|
|
<link rel="alternate" hreflang="{{ .Language.LanguageCode | default .Language.Lang }}" href="{{ .Permalink }}">
|
|
{{- end -}}
|
|
{{- /* x-default must point at the site's DEFAULT content language (English at
|
|
root), independent of the page currently being rendered. site.Languages
|
|
is ordered by weight, so index 0 is the default language. */ -}}
|
|
{{- $defaultLang := (index site.Languages 0).Lang -}}
|
|
{{- range .AllTranslations -}}
|
|
{{- if eq .Language.Lang $defaultLang -}}
|
|
<link rel="alternate" hreflang="x-default" href="{{ .Permalink }}">
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- range .Translations -}}
|
|
<meta property="og:locale:alternate" content="{{ replace (.Language.LanguageCode | default .Language.Lang) "-" "_" }}">
|
|
{{- end -}}
|
|
{{- end }}
|
|
|
|
{{ with .OutputFormats.Get "RSS" -}}
|
|
<link rel="alternate" type="application/rss+xml" href="{{ .RelPermalink }}" title="{{ $brand.name }} RSS">
|
|
{{- end }}
|
|
|
|
{{ partial "schema-jsonld.html" . }}
|