Hello, I’m currently stuck on trying to remove a trailing “,” from the following schema.org itemprop keywords list.
I’m using itemprop keywords from this issue:
I’ve modified it to remove the “,” from the .IsPage content by tweaking:
<meta itemprop="keywords" content="{{ if .IsPage}}{{ range $index, $tag := .Params.tags }}{{ $tag }},{{ end }}{{ else }}{{ range $plural, $terms := .Site.Taxonomies }}{{ range $term, $val := $terms }}{{ printf "%s," $term }}{{ end }}{{ end }}{{ end }}" />
to:
<meta itemprop="keywords" content="{{ if .IsPage}}{{ range $index, $tag := .Params.tags }}{{ if $index }},{{ end }}{{ $tag }}{{ end }}{{ else }}{{ rang e $plural, $terms := .Site.Taxonomies }}{{ range $term, $val := $terms }}{{ printf "%s," $term }}{{ end }}{{ end }}{{ end }}" />
Which works to strip the trailing “,” from the individual .isPage post but on the main home page the “,” is there. I cannot figure out how to exclude this within the range of $term, $val. Can anyone assist?
The goal is to get:
<meta itemprop="keywords" content="key1,key2,key3" />
and not:
<meta itemprop="keywords" content="key1,key2,key3,"/>'
Thanks!