{{- $ := index . "$" -}} {{- $path := "" -}} {{- with .File -}} {{- $path = .Path -}} {{- else -}} {{- $path = .Path -}} {{- end -}} {{- $htmlTitle := .title -}} {{- if eq $.Kind "home" -}} {{- $htmlTitle = $htmlTitle | default $.Site.Title -}} {{- else if eq $.Kind "taxonomy" -}} {{- $htmlTitle = $htmlTitle | default ($.Type | title) -}} {{- else if eq $.Kind "term" -}} {{- $taxonomyTermTitle := $htmlTitle | default $.Data.Term | default (delimit (last 1 (split (strings.TrimSuffix "/_index.md" $path) "/")) " ") -}} {{- with $.Site.GetPage (printf "/%s" $.Data.Plural) -}} {{- $htmlTitle = printf "%s: %s" (.Title | default (.Type | title)) $taxonomyTermTitle -}} {{- end -}} {{- else if eq $.Kind "section" -}} {{- $htmlTitle = $htmlTitle | default (delimit (last 1 (split (strings.TrimSuffix "/_index.md" $path) "/")) " ") -}} {{- end -}} {{- $htmlTitle = partial "utils/markdownify.html" (dict "$" $ "raw" $htmlTitle "isContent" false) -}} {{- $rawTitle := $htmlTitle | plainify | htmlUnescape -}} {{- $title := $rawTitle -}} {{- if ne $.Kind "home" -}} {{- $title = printf "%s | %s" $title $.Site.Title -}} {{- end -}} {{- return dict "rawTitle" $rawTitle "title" $title "htmlTitle" $htmlTitle -}}