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

uci-hugo-doc
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
1 changed files with 3 additions and 1 deletions

View File

@ -58,7 +58,9 @@
{{- end }} {{- end }}
"url" : "{{ .Permalink }}", "url" : "{{ .Permalink }}",
"wordCount" : "{{ .WordCount }}", "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> </script>
{{ end }} {{ end }}