How to create a Select or Relationship field populated by data file

In Hugo, I have data files with an array of items in them (e.g. data/languages.yaml), see below for the structure.

In a separate page (e.g. content/article/article-slug.md), I’d like to select an item or items from one of those lists.

This is either a “select” widget where the options are sourced from the file, or a “relationship” widget.

At any rate, I’m not sure how to structure this and I’m wondering if anyone has hints or examples to draw from.
├── content
│ ├── article
│ │ ├── article-slug.md

├── data
│ ├── languages.yaml
│ └── services.yaml

Hi @budparr, how are the data files structured? Could you create a collection representing them and then set up a relation widget to link from articles to those collections?

Hey, @erez. Thanks for responding. It’s just a simple array, and what you suggest is what I’ve been trying. But sounds like it’s doable from your comment so I’ll just continue to fool around with some configurations until I figure it out.

2 Likes