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 }}
{{- $baseURL := urls.Parse site.BaseURL }}
{{- $baseURLpath := $baseURL.Path | default "/" }}
{{- $l := "" }}
{{- $l := $context.RelPermalink }}
{{- $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 }}
{{- if eq .Language.Lang $langsrc }}
{{- $l = .RelPermalink }}

View file

@ -5,12 +5,14 @@
<head>
{{- partial "meta.html" . }}
{{- .Scratch.Add "title" "" }}
{{- $title := .Title }}
{{- if eq .Site.Data.titles .Title }}
{{- .Scratch.Set "title" (index .Site.Data.titles .Title).title }}
{{- else }}
{{- .Scratch.Set "title" .Title}}
{{- $title = (index .Site.Data.titles .Title).title }}
{{- 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 }}">
{{- partialCached "favicon.html" . }}
{{- partialCached "stylesheet.html" (dict "page" . "outputFormat" $outputFormat) $outputFormat }}

View file

@ -16,7 +16,7 @@
{{- else if eq .Kind "term" }}
{{- $title = printf "%s %s" (.Data.Singular | humanize) $title }}
{{- 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 }}
{{- end }}
<title>{{ $title }}</title>