diff --git a/layouts/_default/single.html b/layouts/_default/single.html index c97a9d0..c7ecb8d 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -41,7 +41,8 @@ } {{- if or (.Params.categories) (.Params.tags) -}} , - "keywords": "{{ with .Params.categories }}{{ range $i, $e := . }}{{ if $i }},{{ end }}{{ $e }}{{ end }},{{ end }}{{ with .Params.tags }}{{ range $i, $e := . }}{{ if $i }},{{ end }}{{ $e }}{{ end }}{{ end }}" + {{- /* delimit keywords by comma, even if one of .Params.categories or Params.tags is nil */ -}} + "keywords": "{{ delimit (union .Params.categories .Params.tags) ", " }}" {{- end }} {{- with .Params.description -}}