93 lines
3 KiB
HTML
93 lines
3 KiB
HTML
{{/* ---- Resolved values ---- */}}
|
|
{{ $title := cond .IsHome .Site.Title (printf "%s | %s" .Title .Site.Title) }}
|
|
{{ $description := or .Description (i18n "siteDescription") }}
|
|
{{ $url := .Permalink }}
|
|
{{ $lang := .Site.Language.Lang }}
|
|
{{ $locale := replace .Site.LanguageCode "-" "_" }}
|
|
{{ $ogImage := .Site.Params.ogImage }}
|
|
{{ $logoImage := or .Site.Params.logoImage .Site.Params.ogImage }}
|
|
{{ $imageAlt := i18n "seoImageAlt" }}
|
|
|
|
{{/* ---- Canonical ---- */}}
|
|
<link rel="canonical" href="{{ $url }}">
|
|
|
|
{{/* ---- Meta robots ---- */}}
|
|
{{ if or .Params.noindex .Draft }}
|
|
<meta name="robots" content="noindex, nofollow">
|
|
{{ else }}
|
|
<meta name="robots" content="index, follow">
|
|
{{ end }}
|
|
|
|
{{/* ---- Meta description ---- */}}
|
|
{{ with $description }}
|
|
<meta name="description" content="{{ . | plainify | truncate 160 }}">
|
|
{{ end }}
|
|
|
|
{{/* ---- Hreflang alternates ---- */}}
|
|
{{ range .AllTranslations }}
|
|
<link rel="alternate" hreflang="{{ .Language.Lang }}" href="{{ .Permalink }}">
|
|
{{ end }}
|
|
{{ range .AllTranslations }}
|
|
{{ if eq .Language.Weight 1 }}
|
|
<link rel="alternate" hreflang="x-default" href="{{ .Permalink }}">
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{/* ---- Open Graph ---- */}}
|
|
<meta property="og:site_name" content="{{ .Site.Title }}">
|
|
<meta property="og:title" content="{{ $title }}">
|
|
<meta property="og:description" content="{{ $description | plainify | truncate 200 }}">
|
|
<meta property="og:url" content="{{ $url }}">
|
|
<meta property="og:locale" content="{{ $locale }}">
|
|
{{ if .IsHome }}
|
|
<meta property="og:type" content="website">
|
|
{{ else }}
|
|
<meta property="og:type" content="article">
|
|
{{ end }}
|
|
{{ with $ogImage }}
|
|
<meta property="og:image" content="{{ . | absURL }}">
|
|
<meta property="og:image:secure_url" content="{{ . | absURL }}">
|
|
<meta property="og:image:alt" content="{{ $imageAlt }}">
|
|
<link rel="image_src" href="{{ . | absURL }}">
|
|
{{ end }}
|
|
|
|
{{/* ---- Twitter Card ---- */}}
|
|
<meta name="twitter:card" content="summary_large_image">
|
|
<meta name="twitter:title" content="{{ $title }}">
|
|
<meta name="twitter:description" content="{{ $description | plainify | truncate 200 }}">
|
|
{{ with .Site.Params.twitterHandle }}
|
|
<meta name="twitter:site" content="{{ . }}">
|
|
{{ end }}
|
|
{{ with $ogImage }}
|
|
<meta name="twitter:image" content="{{ . | absURL }}">
|
|
<meta name="twitter:image:alt" content="{{ $imageAlt }}">
|
|
{{ end }}
|
|
|
|
{{/* ---- JSON-LD Organization (home only) ---- */}}
|
|
{{ if .IsHome }}
|
|
<script type="application/ld+json">
|
|
{
|
|
"@context": "https://schema.org",
|
|
"@type": "Organization",
|
|
"name": "{{ .Site.Title }}",
|
|
"url": "{{ .Site.BaseURL }}",
|
|
"description": "{{ i18n "siteDescription" | plainify }}",
|
|
"logo": "{{ $logoImage | absURL }}",
|
|
"sameAs": [
|
|
{{ with .Site.Params.repositoryUrl }}"{{ . }}"{{ end }}
|
|
]
|
|
}
|
|
</script>
|
|
{{ end }}
|
|
|
|
{{/* ---- JSON-LD WebSite (home only — enables sitelinks search) ---- */}}
|
|
{{ if .IsHome }}
|
|
<script type="application/ld+json">
|
|
{
|
|
"@context": "https://schema.org",
|
|
"@type": "WebSite",
|
|
"name": "{{ .Site.Title }}",
|
|
"url": "{{ .Site.BaseURL }}"
|
|
}
|
|
</script>
|
|
{{ end }}
|