|
16 | 16 | ]
|
17 | 17 | }
|
18 | 18 | </script>
|
19 |
| -{{- else if .IsPage }} |
| 19 | +{{- else if (or .IsPage .IsSection) }} |
| 20 | +{{/* BreadcrumbList */}} |
| 21 | +{{- $url := replace .Parent.Permalink ( printf "%s" .Site.BaseURL) "" }} |
| 22 | +{{- $lang_url := replace $url ( printf "%s" .Lang) "" }} |
| 23 | +{{- $bc_list := (split $lang_url "/")}} |
| 24 | + |
| 25 | +{{- $scratch := newScratch }} |
| 26 | +<script type="application/ld+json"> |
| 27 | +{ |
| 28 | + "@context": "https://schema.org", |
| 29 | + "@type": "BreadcrumbList", |
| 30 | + "itemListElement": [ |
| 31 | + {{- range $index, $element := $bc_list }} |
| 32 | + |
| 33 | + {{- $scratch.Add "path" (printf "%s/" $element ) | safeJS }} |
| 34 | + {{- $bc_pg := $.Site.GetPage ($scratch.Get "path") -}} |
| 35 | + |
| 36 | + {{- if (and ($bc_pg) (gt (len . ) 0))}} |
| 37 | + {{- if (and $index)}}, {{end }} |
| 38 | + { |
| 39 | + "@type": "ListItem", |
| 40 | + "position": {{ add 1 $index }}, |
| 41 | + "name": {{ $bc_pg.Name }}, |
| 42 | + "item": {{ $bc_pg.Permalink | safeHTML }} |
| 43 | + } |
| 44 | + {{- end }} |
| 45 | + |
| 46 | + {{- end }} |
| 47 | + {{- /* self-page addition */ -}} |
| 48 | + {{- if $bc_list }}, {{end }} |
| 49 | + { |
| 50 | + "@type": "ListItem", |
| 51 | + "position": {{len $bc_list}}, |
| 52 | + "name": {{ .Name }}, |
| 53 | + "item": {{ .Permalink | safeHTML }} |
| 54 | + } |
| 55 | + ] |
| 56 | +} |
| 57 | +</script> |
| 58 | +{{- if .IsPage }} |
20 | 59 | <script type="application/ld+json">
|
21 | 60 | {
|
22 | 61 | "@context": "https://schema.org",
|
|
75 | 114 | }
|
76 | 115 | }
|
77 | 116 | </script>
|
| 117 | +{{ end }}{{/* .IsPage end */}} |
| 118 | + |
78 | 119 | {{ end }}
|
0 commit comments