From 98c88d8e2ee45a101e313dc4b29a8f44bcd689cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Thu, 4 May 2023 22:07:59 +0200 Subject: [PATCH] theme: better HTML titles and breadcrumbs for search and tag pages #521 --- layouts/partials/header.html | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 52e0df0d31..90efba22ec 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -10,11 +10,15 @@ {{- partial "meta.html" . }} {{- $page := . }} {{- $link := "" }} - {{- $title := "" }} - {{- if and .Title (not (eq .Title .Site.Title)) }} - {{- $title = printf "%s %s " .Title (default "::" .Site.Params.titleSeparator) }} + {{- $title := .Title }} + {{- if eq $outputFormat "searchpage" }} + {{- $title = T "Search" }} + {{- else if eq .Kind "term" }} + {{- $title = printf "%s %s" (.Data.Singular | humanize) $title }} + {{- end }} + {{- if and $title (not (eq $title .Site.Title)) }} + {{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) .Site.Title }} {{- end }} - {{- $title = printf "%s%s" $title .Site.Title }} {{ $title }} {{- if .IsTranslated -}} @@ -173,7 +177,14 @@ {{- $remaining = sub $remaining 1 }} {{- if $ispublished }} {{- $depth = add $depth 1 }} -
  • {{ if $remaining }}{{end}}{{ if $to.Title }}{{ $to.Title }}{{ else }}{{ $to.Site.Title }}{{ end }}{{ if $remaining }}{{ end }}{{ if $remaining }} > {{ end }}
  • + {{- $title := $to.Title }} + {{- if eq .Kind "term" }} + {{- $title = printf "%s %s" (.Data.Singular | humanize) $title }} + {{- end }} + {{- if not $title }} + {{- $title = $to.Site.Title }} + {{- end }} +
  • {{ if $remaining }}{{end}}{{ $title }}{{ if $remaining }}{{ end }}{{ if $remaining }} > {{ end }}
  • {{- end }} {{- end }} {{- end }} \ No newline at end of file