Skip to content

Commit 79e087d

Browse files
committed
data-vocabulary.org schema deprecated by Google
Now use schema.org as explained at https://webmasters.googleblog.com/2020/01/data-vocabulary.html Signed-off-by: Maxime Soulé <[email protected]>
1 parent d4abb3c commit 79e087d

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

layouts/partials/header.html

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
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>
@@ -72,7 +72,9 @@
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}}

0 commit comments

Comments
 (0)