theme: make sure to display well with no theme specific params set #516

This commit is contained in:
Sören Weber 2023-05-18 14:03:39 +02:00
parent 77f41e9607
commit c975dfd2de
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
3 changed files with 15 additions and 6 deletions

View file

@ -6,8 +6,15 @@
{{- $langsrc := cond (eq $context.Lang $langtrg) (.langsrc | default "en") $context.Lang }} {{- $langsrc := cond (eq $context.Lang $langtrg) (.langsrc | default "en") $context.Lang }}
{{- $baseURL := urls.Parse site.BaseURL }} {{- $baseURL := urls.Parse site.BaseURL }}
{{- $baseURLpath := $baseURL.Path | default "/" }} {{- $baseURLpath := $baseURL.Path | default "/" }}
{{- $l := "" }} {{- $l := $context.RelPermalink }}
{{- $c := "" }} {{- $c := "" }}
{{- if ne $content nil }}
{{- $c = $content }}
{{- else if eq $pagefield "Content" }}
{{- $c = $context.Content }}
{{- else if eq $pagefield "TableOfContents" }}
{{- $c = $context.TableOfContents }}
{{- end }}
{{- range $context.AllTranslations }} {{- range $context.AllTranslations }}
{{- if eq .Language.Lang $langsrc }} {{- if eq .Language.Lang $langsrc }}
{{- $l = .RelPermalink }} {{- $l = .RelPermalink }}

View file

@ -5,12 +5,14 @@
<head> <head>
{{- partial "meta.html" . }} {{- partial "meta.html" . }}
{{- .Scratch.Add "title" "" }} {{- .Scratch.Add "title" "" }}
{{- $title := .Title }}
{{- if eq .Site.Data.titles .Title }} {{- if eq .Site.Data.titles .Title }}
{{- .Scratch.Set "title" (index .Site.Data.titles .Title).title }} {{- $title = (index .Site.Data.titles .Title).title }}
{{- else }}
{{- .Scratch.Set "title" .Title}}
{{- end }} {{- end }}
<title>{{ .Scratch.Get "title" }} {{ default "::" .Site.Params.titleSeparator }} {{ .Site.Title }}</title> {{- if and $title .Site.Title (not (eq $title .Site.Title)) }}
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) .Site.Title }}
{{- end }}
<title>{{ $title }}</title>
<base href="{{ .Site.BaseURL }}"> <base href="{{ .Site.BaseURL }}">
{{- partialCached "favicon.html" . }} {{- partialCached "favicon.html" . }}
{{- partialCached "stylesheet.html" (dict "page" . "outputFormat" $outputFormat) $outputFormat }} {{- partialCached "stylesheet.html" (dict "page" . "outputFormat" $outputFormat) $outputFormat }}

View file

@ -16,7 +16,7 @@
{{- else if eq .Kind "term" }} {{- else if eq .Kind "term" }}
{{- $title = printf "%s %s" (.Data.Singular | humanize) $title }} {{- $title = printf "%s %s" (.Data.Singular | humanize) $title }}
{{- end }} {{- end }}
{{- if and $title (not (eq $title .Site.Title)) }} {{- if and $title .Site.Title (not (eq $title .Site.Title)) }}
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) .Site.Title }} {{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) .Site.Title }}
{{- end }} {{- end }}
<title>{{ $title }}</title> <title>{{ $title }}</title>