mirror of https://github.com/theNewDynamic/gohugo-theme-ananke.git

Patrick Kollitsch
2 days ago 9675ff2dc36a5448f31e918676c402f7fa5b8f4a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{{- /*
  Return an explicitly set title, description, or linktitle through its Page
  method. Preserve the former templates' empty-field fallbacks and custom
  params overrides, which can differ from the reserved front matter fields.
  Inspect the parameter map with index, not a deprecated .Params.field lookup.
*/ -}}
{{- $page := .page -}}
{{- $field := .field -}}
{{- $value := false -}}
{{- if collections.IsSet $page.Params $field -}}
  {{- $methods := dict "title" $page.Title "description" $page.Description "linktitle" $page.LinkTitle -}}
  {{- $value = index $methods $field -}}
  {{- $stored := index $page.Params $field -}}
  {{- if ne $stored $value -}}
    {{- $value = $stored -}}
  {{- end -}}
{{- end -}}
{{- return $value -}}