mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2025-02-21 11:10:07 +00:00
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
This commit is contained in:
parent
de59e6700a
commit
0dd98363fb
3 changed files with 9 additions and 7 deletions
|
@ -52,7 +52,7 @@
|
|||
{{- $showBreadcrumb := (and (not .Params.disableBreadcrumb) (not .Site.Params.disableBreadcrumb)) }}
|
||||
{{- if $showBreadcrumb }}
|
||||
<ol class="topbar-breadcrumbs breadcrumbs highlightable" itemscope itemtype="http://schema.org/BreadcrumbList">
|
||||
{{- partial "breadcrumbs.html" (dict "page" .) }}
|
||||
{{- partial "breadcrumbs.html" (dict "page" . "schema" true) }}
|
||||
</ol>
|
||||
{{- else }}
|
||||
<span class="topbar-breadcrumbs highlightable">
|
||||
|
|
|
@ -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 "<li" | safeHTML }}
|
||||
itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement">{{ if $link }}<a itemprop="item" href="{{ $url }}">{{end}}<span itemprop="name">{{ $title }}</span>{{ if $link }}</a>{{ end }}<meta itemprop="position" content="{{ $depth }}">{{ if not $isLast }}{{ (printf " %s " (default ">" .Site.Params.breadcrumbSeparator)) | safeHTML }}{{ end }}</li>
|
||||
{{- if or $.schema (not $class) }}
|
||||
<li{{ if $.schema }} itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement"{{ end }} class="{{ $class | safeHTMLAttr }}">{{ if $link }}<a{{ if $.schema }} itemprop="item"{{ end }} href="{{ $url }}">{{end}}<span{{ if $.schema }} itemprop="name"{{ end }}>{{ $title }}</span>{{ if $link }}</a>{{ end }}{{ if $.schema }}<meta itemprop="position" content="{{ $depth }}">{{ end }}{{ if not $isLast }}{{ (printf " %s " (default ">" .Site.Params.breadcrumbSeparator)) | safeHTML }}{{ end }}</li>
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -1 +1 @@
|
|||
7.3.2+52fcb55f86db03a6d41139167165505e62cf5364
|
||||
7.3.2+de59e6700a230cecc75cebb1b225fe189f0189e7
|
Loading…
Add table
Reference in a new issue