Skip to content

Commit

Permalink
theme: better HTML titles and breadcrumbs for search and tag pages ma…
Browse files Browse the repository at this point in the history
  • Loading branch information
McShelby committed May 4, 2023
1 parent b11969b commit 98c88d8
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions layouts/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@
{{- partial "meta.html" . }}
{{- $page := . }}
{{- $link := "<link href=\"%s\" rel=\"%s\" type=\"%s\" title=\"%s\">" }}
{{- $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>{{ $title }}</title>

{{- if .IsTranslated -}}
Expand Down Expand Up @@ -173,7 +177,14 @@
{{- $remaining = sub $remaining 1 }}
{{- if $ispublished }}
{{- $depth = add $depth 1 }}
<li itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement">{{ if $remaining }}<a itemprop="item" href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" $to) }}">{{end}}<span itemprop="name">{{ if $to.Title }}{{ $to.Title }}{{ else }}{{ $to.Site.Title }}{{ end }}</span>{{ if $remaining }}</a>{{ end }}<meta itemprop="position" content="{{ $depth }}">{{ if $remaining }} > {{ end }}</li>
{{- $title := $to.Title }}
{{- if eq .Kind "term" }}
{{- $title = printf "%s %s" (.Data.Singular | humanize) $title }}
{{- end }}
{{- if not $title }}
{{- $title = $to.Site.Title }}
{{- end }}
<li itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement">{{ if $remaining }}<a itemprop="item" href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" $to) }}">{{end}}<span itemprop="name">{{ $title }}</span>{{ if $remaining }}</a>{{ end }}<meta itemprop="position" content="{{ $depth }}">{{ if $remaining }} > {{ end }}</li>
{{- end }}
{{- end }}
{{- end }}

0 comments on commit 98c88d8

Please sign in to comment.