How to add array field to collections in Hugo

Hello everyone, I just finished setting up NetlifyCMS on my blog. Thanks to @talves and @tomrutgers :slight_smile:

One thing I haven’t been able to set up is the tags field in collections.
In Hugo, there’s a collection for tags which usually is in this format

tags: ["netlify", "netlifyCMS", "CMS"]

I tried:

- {label: "Tags", name: "tags", widget: "array"}

but it didn’t work.
I wanted to ask if there’s a possible way of adding a field that’ll accept an array of tags?
Thank you.

I also tried:

- {label: "Tags", name: "tags", widget: "text"}

I then passed in ["netlify", "netlifyCMS", "CMS"] in the text field.

It almost worked, but the output was an array string '[ "C++", "VsCode", "Compiler" ]'

Try the list widget:
- {label: "Tags", name: "tags", widget: "list"}

https://www.netlifycms.org/docs/widgets/#list

3 Likes