68 lines
2.4 KiB
HTML
68 lines
2.4 KiB
HTML
{{- $page := . -}}
|
|
{{- $data := dict -}}
|
|
{{- if reflect.IsMap . -}}
|
|
{{- with index . "Page" -}}
|
|
{{- $page = . -}}
|
|
{{- end -}}
|
|
{{- with index . "Data" -}}
|
|
{{- $data = . -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- if eq (len $data) 0 -}}
|
|
{{- $data = partialCached "head/data.html" $page $page.RelPermalink -}}
|
|
{{- end -}}
|
|
{{- $title := index $data "title" -}}
|
|
{{- $socialTitle := index $data "socialTitle" -}}
|
|
{{- $description := index $data "description" -}}
|
|
{{- $openGraphImage := index $data "openGraphImage" -}}
|
|
{{- $twitterImage := index $data "twitterImage" -}}
|
|
{{- $robots := index $data "robots" -}}
|
|
{{- $ogType := index $data "ogType" -}}
|
|
{{- $locale := index $data "locale" -}}
|
|
<title>{{ $title }}</title>
|
|
{{- with $description }}
|
|
<meta name="description" content="{{ . }}">
|
|
{{- end }}
|
|
<meta name="theme-color" content="{{ $page.Site.Params.themeColor | default "#060c14" }}">
|
|
<meta name="robots" content="{{ $robots }}">
|
|
<link rel="canonical" href="{{ $page.Permalink }}">
|
|
<meta property="og:locale" content="{{ $locale }}">
|
|
<meta property="og:site_name" content="{{ $page.Site.Title }}">
|
|
<meta property="og:type" content="{{ $ogType }}">
|
|
<meta property="og:title" content="{{ $socialTitle }}">
|
|
<meta property="og:url" content="{{ $page.Permalink }}">
|
|
{{- with $description }}
|
|
<meta property="og:description" content="{{ . }}">
|
|
{{- end }}
|
|
{{- with $openGraphImage.url }}
|
|
<meta property="og:image" content="{{ . }}">
|
|
{{- end }}
|
|
{{- with $openGraphImage.width }}
|
|
<meta property="og:image:width" content="{{ . }}">
|
|
{{- end }}
|
|
{{- with $openGraphImage.height }}
|
|
<meta property="og:image:height" content="{{ . }}">
|
|
{{- end }}
|
|
{{- with $openGraphImage.alt }}
|
|
<meta property="og:image:alt" content="{{ . }}">
|
|
{{- end }}
|
|
<meta name="twitter:card" content="summary">
|
|
<meta name="twitter:title" content="{{ $socialTitle }}">
|
|
{{- with $description }}
|
|
<meta name="twitter:description" content="{{ . }}">
|
|
{{- end }}
|
|
{{- with $twitterImage.url }}
|
|
<meta name="twitter:image" content="{{ . }}">
|
|
{{- end }}
|
|
{{- with $twitterImage.alt }}
|
|
<meta name="twitter:image:alt" content="{{ . }}">
|
|
{{- end }}
|
|
{{- if and (eq $ogType "article") (index (index $data "pageClassification") "isArticleLike") -}}
|
|
{{- with $page.Date }}
|
|
<meta property="article:published_time" content="{{ .Format "2006-01-02T15:04:05Z07:00" }}">
|
|
{{- end }}
|
|
{{- with $page.Lastmod }}
|
|
<meta property="article:modified_time" content="{{ .Format "2006-01-02T15:04:05Z07:00" }}">
|
|
{{- end }}
|
|
{{- end -}}
|