From 0dd98363fbc04746c77cd13539a0d1b3f1a9de8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Sun, 16 Feb 2025 21:29:54 +0100 Subject: [PATCH] breadcrumb: fix Google Search Console errors #1026 home page did not generate schema info when disableTermBreadcrumbs=true was set; now we are always generating the information but hide them from the viewer if necessary --- layouts/_default/baseof.html | 2 +- layouts/partials/breadcrumbs.html | 12 +++++++----- layouts/partials/version.txt | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 4e37123293..579a8af6e1 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -52,7 +52,7 @@ {{- $showBreadcrumb := (and (not .Params.disableBreadcrumb) (not .Site.Params.disableBreadcrumb)) }} {{- if $showBreadcrumb }} {{- else }} diff --git a/layouts/partials/breadcrumbs.html b/layouts/partials/breadcrumbs.html index 78a88a6f3e..788f6c2a70 100644 --- a/layouts/partials/breadcrumbs.html +++ b/layouts/partials/breadcrumbs.html @@ -8,9 +8,6 @@ {{- $lasturl = partial "permalink.gotmpl" (dict "to" $page) }} {{- end }} {{- $depth := add 1 (int (partial "_relearn/pageDepth.gotmpl" (dict "page" $page))) }} -{{- if .page.Site.Params.disableRootBreadcrumb }} - {{- $depth = add $depth -1 }} -{{- end }} {{- $breadcrumb := slice }} {{- range seq $depth }} {{- if $to }} @@ -33,11 +30,16 @@ {{- range $i, $e := $breadcrumbReversed }} {{- $to := $e }} {{- $depth = add $depth 1 }} + {{- $class := "" }} + {{- if and (eq $depth 1) site.Params.disableRootBreadcrumb }} + {{- $class = "a11y-only" }} + {{- end }} {{- $title := partial "title.gotmpl" (dict "page" $to "linkTitle" true) }} {{- $url := partial "permalink.gotmpl" (dict "to" $to) }} {{- $isPage := eq $url $pageurl }} {{- $isLast := eq $url $lasturl }} {{- $link := and $url (not $isPage) }} - {{- printf "{{ if $link }}{{end}}{{ $title }}{{ if $link }}{{ end }}{{ if not $isLast }}{{ (printf " %s " (default ">" .Site.Params.breadcrumbSeparator)) | safeHTML }}{{ end }} + {{- if or $.schema (not $class) }} + {{ if $link }}{{end}}{{ $title }}{{ if $link }}{{ end }}{{ if $.schema }}{{ end }}{{ if not $isLast }}{{ (printf " %s " (default ">" .Site.Params.breadcrumbSeparator)) | safeHTML }}{{ end }} + {{- end }} {{- end }} \ No newline at end of file diff --git a/layouts/partials/version.txt b/layouts/partials/version.txt index 7799b2b9d2..44b00a1cba 100644 --- a/layouts/partials/version.txt +++ b/layouts/partials/version.txt @@ -1 +1 @@ -7.3.2+52fcb55f86db03a6d41139167165505e62cf5364 \ No newline at end of file +7.3.2+de59e6700a230cecc75cebb1b225fe189f0189e7 \ No newline at end of file