Minor codestyle fixes to meta_breadcrumb. Moving safeJS to the partial output.

This commit is contained in:
Fredrik Jonsson 2023-04-23 20:59:21 +02:00
commit 86d7c8d001

View file

@ -1,17 +1,14 @@
<script type="application/ld+json">
{{- $blogSections := site.Params.blogSections | default (slice "blog" "post") }}
{{- $breadcrumbSections := site.Params.breadcrumbSections | default (slice) }}
{{ $blogSections := site.Params.blogSections | default (slice "blog" "post") -}}
{{ $breadcrumbSections := site.Params.breadcrumbSections | default (slice) -}}
{
"@context": "https://schema.org",
{{ if .IsPage -}}
"@type": {{ if in $blogSections .Section -}}
"BlogPosting",
{{- else -}}
"WebPage",
{{- if in $breadcrumbSections .Section }}
"breadcrumb": {{ safeJS (partial "meta_breadcrumb_json_ld.html" .) }},
{{- end -}}
{{- end }}
"@type": {{ if in $blogSections .Section }}"BlogPosting",{{ else }}"WebPage",
{{ if in $breadcrumbSections .Section -}}
"breadcrumb": {{ partial "meta_breadcrumb_json_ld.html" . }},
{{ end -}}
{{ end -}}
"headline": {{ .Title }},
"datePublished": {{ .Date.Format "2006-01-02T15:04:05Z07:00" }},
"dateModified": {{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }},
@ -24,9 +21,9 @@
{{ end -}}
{{ else -}}
"@type": "WebPage",
{{- if in $breadcrumbSections .Section }}
"breadcrumb": {{ safeJS (partial "meta_breadcrumb_json_ld.html" .) }},
{{- end }}
{{ if in $breadcrumbSections .Section -}}
"breadcrumb": {{ partial "meta_breadcrumb_json_ld.html" . }},
{{ end -}}
"url" : {{ .Permalink }},
"name": {{ .Title }},
{{ with $.Param "description" -}}