diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 3a2bfeb104..55f8d319f6 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -4,20 +4,27 @@ {{- partial "meta.html" . }} {{- $page := . }} {{- $link := "" }} - {{ if and .Title (not (eq .Title .Site.Title)) }}{{ .Title }} {{ default "::" .Site.Params.titleSeparator }} {{ end}}{{ .Site.Title }} + {{- $title := "" }} + {{- if and .Title (not (eq .Title .Site.Title)) }} + {{- $title = printf "%s %s " .Title (default "::" .Site.Params.titleSeparator) }} + {{- end }} + {{- $title = printf "%s%s" $title .Site.Title }} + {{ $title }} {{- if not (and .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSeoHiddenPages true) ) ) }} {{- else }} {{- range .AlternativeOutputFormats }} - {{- if and (ne .Name "JSON") (ne .Name "SEARCH") }} - {{ (printf $link (partial "relLangPrettyUglyURL.hugo" (dict "page" $page "to" .)) .Rel .MediaType.Type ($.Site.Title | htmlEscape)) | safeHTML }} + {{- if eq .Rel "canonical" }} + {{ (printf $link .Permalink .Rel .MediaType.Type ($title | htmlEscape)) | safeHTML }} + {{- else if and (ne .Name "JSON") (ne .Name "SEARCH") }} + {{ (printf $link (partial "relLangPrettyUglyURL.hugo" (dict "page" $page "to" .)) .Rel .MediaType.Type ($title | htmlEscape)) | safeHTML }} {{- end }} {{- end }} {{- end }} {{- if and (ne .Site.Params.disableSeoHiddenPages true) (ne .Site.Params.disableSearchHiddenPages true) }} {{- range .AlternativeOutputFormats }} {{- if eq .Name "JSON" }} - {{ (printf $link (.Permalink | relURL) .Rel .MediaType.Type ($.Site.Title | htmlEscape)) | safeHTML }} + {{ (printf $link (.Permalink | relURL) .Rel .MediaType.Type ($title | htmlEscape)) | safeHTML }} {{- end }} {{- end }} {{- end }}