|
| 1 | +<meta charset="utf-8"> |
| 2 | +<meta http-equiv="content-type" content="text/html"> |
| 3 | +<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 4 | + |
| 5 | +<title itemprop="name">{{ .Title }} | {{ .Site.Title }}</title> |
| 6 | +<meta property="og:title" content="{{ .Title }} | {{ .Site.Title }}" /> |
| 7 | +<meta name="twitter:title" content="{{ .Title }} | {{ .Site.Title }}" /> |
| 8 | +<meta itemprop="name" content="{{ .Title }} | {{ .Site.Title }}" /> |
| 9 | +<meta name="application-name" content="{{ .Title }} | {{ .Site.Title }}" /> |
| 10 | +<meta property="og:site_name" content="{{ .Site.Params.sitename }}" /> |
| 11 | + |
| 12 | +{{/* Define empty variable description */}} |
| 13 | +{{- $description := "" -}} |
| 14 | + |
| 15 | +{{/* If description is defined in front matter, use it */}} |
| 16 | +{{- if .Params.description -}} |
| 17 | + {{- $description = trim .Params.description "\n" -}} |
| 18 | +{{/* If description is not defined in front matter, use site description */}} |
| 19 | +{{- else if .Site.Params.description -}} |
| 20 | + {{- $description = trim .Site.Params.description "\n" -}} |
| 21 | +{{- end -}} |
| 22 | + |
| 23 | +<meta name="description" content="{{ $description }}"> |
| 24 | +<meta itemprop="description" content="{{ $description }}" /> |
| 25 | +<meta property="og:description" content="{{ $description }}" /> |
| 26 | +<meta name="twitter:description" content="{{ $description }}" /> |
| 27 | + |
| 28 | +<meta property="og:locale" content="{{ .Site.LanguageCode }}" /> |
| 29 | +<meta name="language" content="{{ .Site.LanguageCode }}" /> |
| 30 | +{{ range .AllTranslations }} |
| 31 | + <link rel="alternate" hreflang="{{ .Language.Lang }}" href="{{ .Permalink }}" title="{{ .Language.LanguageName }}" /> |
| 32 | +{{ end }} |
| 33 | + |
| 34 | +{{/* Build image URL - handle page bundles correctly */}} |
| 35 | +{{- $imageURL := "" -}} |
| 36 | + |
| 37 | +{{/* Check for images array (plural) first, then image (singular) */}} |
| 38 | +{{- if .Params.images -}} |
| 39 | + {{- $img := index .Params.images 0 -}} |
| 40 | + {{- if eq .Kind "page" -}} |
| 41 | + {{/* For page bundles, image is relative to the page */}} |
| 42 | + {{- $imageURL = printf "%s%s" .Permalink $img -}} |
| 43 | + {{- else -}} |
| 44 | + {{- $imageURL = $img | absURL -}} |
| 45 | + {{- end -}} |
| 46 | +{{- else if .Params.image -}} |
| 47 | + {{- if eq .Kind "page" -}} |
| 48 | + {{- $imageURL = printf "%s%s" .Permalink .Params.image -}} |
| 49 | + {{- else -}} |
| 50 | + {{- $imageURL = .Params.image | absURL -}} |
| 51 | + {{- end -}} |
| 52 | +{{/* Fallback to site-level images */}} |
| 53 | +{{- else if .Site.Params.images -}} |
| 54 | + {{- $imageURL = index .Site.Params.images 0 | absURL -}} |
| 55 | +{{- else if .Site.Params.ogimage -}} |
| 56 | + {{- $imageURL = .Site.Params.ogimage | absURL -}} |
| 57 | +{{- end -}} |
| 58 | + |
| 59 | +{{- if $imageURL -}} |
| 60 | +<meta itemprop="image" content="{{ $imageURL }}" /> |
| 61 | +<meta property="og:image" content="{{ $imageURL }}" /> |
| 62 | +<meta name="twitter:image" content="{{ $imageURL }}" /> |
| 63 | +<meta name="twitter:image:src" content="{{ $imageURL }}" /> |
| 64 | +{{- end -}} |
0 commit comments