{{ $title := "" }} {{ if .LinkTitle }} {{ $title = .LinkTitle }} {{ else }} {{ $title = index (findRE `# .*` .RawContent) 0 | strings.TrimLeft "# " }} {{ with .File }} {{ with (index (site.Data.frontmatter) .Path) }} {{ with .title }} {{ $title = . }} {{ end }} {{ end }} {{ if not $title }} {{ $title = strings.ReplaceRE "[-_]" " " .TranslationBaseName }} {{ end }} {{ end }} {{ end }} {{ return $title }}