fix: prevent failing build if tags is an empty string (#322)

This commit is contained in:
Robert Kaussow 2022-02-04 13:31:23 +01:00 committed by GitHub
parent fdd4e19d0e
commit 3228f90eef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -58,7 +58,9 @@
{{- end }}
"url" : "{{ .Permalink }}",
"wordCount" : "{{ .WordCount }}",
"genre" : [ {{ range $i, $tag := .Params.tags }}{{ if $i }}, {{ end }}"{{ $tag }}" {{ end }}]
{{- with $tags := .Params.tags }}
"genre" : [ {{ range $i, $tag := $tags }}{{ if $i }}, {{ end }}"{{ $tag }}" {{ end }}]
{{- end }}
}
</script>
{{ end }}