This commit is contained in:
Christian 2025-04-23 14:35:23 -07:00 committed by GitHub
commit aead8be703
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -25,6 +25,7 @@
{{- $url := replace .Parent.Permalink ( printf "%s" site.Home.Permalink) "" }}
{{- $lang_url := strings.TrimPrefix ( printf "%s/" .Lang) $url }}
{{- $bc_list := (split $lang_url "/")}}
{{- $position := 0 }}
{{- $scratch := newScratch }}
<script type="application/ld+json">
@ -38,10 +39,11 @@
{{- $bc_pg := site.GetPage ($scratch.Get "path") -}}
{{- if (and ($bc_pg) (gt (len . ) 0))}}
{{- $position = add 1 $position }}
{{- if (and $index)}}, {{end }}
{
"@type": "ListItem",
"position": {{ add 1 $index }},
"position": {{ $position }},
"name": {{ $bc_pg.Name }},
"item": {{ $bc_pg.Permalink | safeHTML }}
}
@ -49,10 +51,10 @@
{{- end }}
{{- /* self-page addition */ -}}
{{- if (ge (len $bc_list) 2) }}, {{end }}
{{- if (gt $position 0) }}, {{end }}
{
"@type": "ListItem",
"position": {{len $bc_list}},
"position": {{ add 1 $position }},
"name": {{ .Name }},
"item": {{ .Permalink | safeHTML }}
}