File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change 6060 {{ end }}
6161 {{ end }}
6262 {{$toc := (and (not .Params.disableToc) (not .Params.chapter))}}
63- < div id ="breadcrumbs " itemscope ="" itemtype ="http://data-vocabulary .org/Breadcrumb ">
63+ < div id ="breadcrumbs " itemscope ="" itemtype ="http://schema .org/BreadcrumbList ">
6464 < span id ="sidebar-toggle-span ">
6565 < a href ="# " id ="sidebar-toggle " data-sidebar-toggle ="">
6666 < i class ="fas fa-bars "> </ i >
7272 < span class ="links ">
7373 {{$showBreadcrumb := (and (not .Params.disableBreadcrumb) (not .Site.Params.disableBreadcrumb))}}
7474 {{if $showBreadcrumb}}
75- {{ template "breadcrumb" dict "page" . "value" .Title }}
75+ {{ .Scratch.Set "depth" 1 }}
76+ {{ template "computeBreadcrumbDepth" dict "origPage" . "page" . }}
77+ {{ template "breadcrumb" dict "origPage" . "page" . "value" .Title "position" 1 }}
7678 {{ else }}
7779 {{ .Title }}
7880 {{ end }}
@@ -100,11 +102,20 @@ <h1>
100102 </ h1 >
101103 {{end}}
102104
105+ {{define "computeBreadcrumbDepth"}}
106+ {{$scratch := .origPage.Scratch }}
107+ {{$parent := .page.Parent }}
108+ {{ if $parent }}
109+ {{ $scratch.Set "depth" (add ($scratch.Get "depth") 1) }}
110+ {{ template "computeBreadcrumbDepth" dict "origPage" .origPage "page" $parent }}
111+ {{end}}
112+ {{end}}
113+
103114 {{define "breadcrumb"}}
104115 {{$parent := .page.Parent }}
105116 {{ if $parent }}
106- {{ $value := (printf "< a href ='%s '> %s</ a > > %s" $parent.RelPermalink $parent.Title . value) }}
107- {{ template "breadcrumb" dict "page" $parent "value" $value }}
117+ {{ $value := (printf "< span itemscope ='' itemprop =' itemListElement ' itemtype =' http://schema.org/ListItem ' > < a itemprop =' item ' href ='%s '> < span itemprop =' name ' > %s</ span > < meta itemprop =' position ' content =' %d ' /> </ a > </ span > > %s" $parent.RelPermalink $parent.Title (sub (.origPage.Scratch.Get "depth") .position) . value ) }}
118+ {{ template "breadcrumb" dict "origPage" .origPage " page" $parent "value" $value "position" (add .position 1) }}
108119 {{else}}
109120 {{.value|safeHTML}}
110121 {{end}}
You can’t perform that action at this time.
0 commit comments