HUGO

Error calling delimit: can't iterate over <nil>

Error: Error building site: failed to render pages: render of “taxonomyTerm” failed: “c:\Hugo\sites\drblog\themes\test\layouts_default\list.html:17:15”: execute of template failed: template: _default\list.html:17:15: executing “main” at <delimit .Params.tags ", ">: error calling delimit: can’t iterate over

My code that I’m calling looks like this

 {{- if isset .Site.Taxonomies "tags" }}
	 {{- if not (eq (len .Site.Taxonomies.tags) 0) }}
		<span class="px-2">|</span>
             {{ delimit .Params.tags ", " }}
										
	 {{- end }}
{{- end }}

If i remove these then add them back after running the server they work fine

1 Like
  1. One cannot assume .Params.tags will always be set. So I’d recommand using with before anything:
{{ with .Params.tags }}{{ delimit . ", "}}{{ end }}
  1. Are you confident none of your entries have a single string as tags instead of an array of strings?
---
title: Something
tags: Arts And Craft
---
3 Likes

thank you1