mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 15:31:52 +00:00
perf(schema): loop fusion
This commit is contained in:
@@ -49,22 +49,25 @@
|
|||||||
"@context": "https://schema.org",
|
"@context": "https://schema.org",
|
||||||
"@type": "BreadcrumbList",
|
"@type": "BreadcrumbList",
|
||||||
"itemListElement": [
|
"itemListElement": [
|
||||||
{{- $breadcrumbs := slice -}}
|
{{- $position := 0 -}}
|
||||||
{{- range .Ancestors -}}
|
{{- range .Ancestors -}}
|
||||||
{{- if not .IsHome -}}
|
{{- if not .IsHome -}}
|
||||||
{{- $breadcrumbs = $breadcrumbs | append . -}}
|
{{- $position = add $position 1 -}}
|
||||||
|
{
|
||||||
|
"@type": "ListItem",
|
||||||
|
"position": {{ $position }},
|
||||||
|
"name": "{{ .Title }}",
|
||||||
|
"item": {{ .Permalink }}
|
||||||
|
},
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- $breadcrumbs = $breadcrumbs | append . -}}
|
{{- $position = add $position 1 -}}
|
||||||
|
{
|
||||||
{{- range $index, $element := $breadcrumbs -}}
|
"@type": "ListItem",
|
||||||
{
|
"position": {{ $position }},
|
||||||
"@type": "ListItem",
|
"name": "{{ .Title }}",
|
||||||
"position": {{ add $index 1 }},
|
"item": {{ .Permalink }}
|
||||||
"name": "{{ .Title }}",
|
}
|
||||||
"item": {{ .Permalink }},
|
|
||||||
}{{ if ne (add $index 1) (len $breadcrumbs) }},{{ end }}
|
|
||||||
{{- end -}}
|
|
||||||
]
|
]
|
||||||
}{{ end }}]
|
}{{ end }}]
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user