Run delimit on array only

Is there a way to check if variable is an array before running the delimit function on it?

Oddly other variables such languages, year sometime tend to be string instead of an array so delimit doesn’t work predictably.

Here is my /posts/items.json.json file.

{
    "title": "{{ if .Params.title }}{{ .Params.title }}{{ end -}}",
    "authors": "{{ if .Params.authors }}{{ delimit .Params.authors "; " }}{{ end -}}",
    "languages": "{{ if .Params.languages }}{{ .Params.languages }}{{ end -}}",
    "year": "{{ if .Params.year }}{{ .Params.year }}{{ end -}}",
    "permalink": "{{ .Permalink }}",
    
}

Thank you!!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.