Manuel Meurer
Manuel Meurer

Reputation: 3478

Netlify CMS nested YAML using Middleman

I'm trying to get my Middleman page set up with Netlify CMS. I'm using have the following file structure:

data
  > pages
    > page1.yml
    > page2.yml

Each page has this content:

de:
  title: Title in German

en:
  title: Title in English

Now I'd like to be able to edit these pages in Netlify CMS and basically have two text fields per page ("Title (DE)" and "Title (EN)").

I tried it with this config:

collections:
  - label: Pages
    name: pages
    folder: data/pages/
    fields:
      - { label: Title (DE), name: de.title, widget: string, required: true }
      - { label: Title (EN), name: en.title, widget: string, required: true }

But nothing shows up in the Netlify CMS backend:

Screenshot

What am I doing wrong?

Upvotes: 0

Views: 468

Answers (1)

Shawn Erquhart
Shawn Erquhart

Reputation: 1858

I'm guessing your files aren't markdown with frontmatter? If you're using data files, eg. json/yaml/toml, you'll need to set the extension for the collection: https://www.netlifycms.org/docs/configuration-options/#extension-and-format

Also, you need a field named title, or else set identifier_field to the name of the field you'd like to use as the identifier (otherwise your files will show as blank tiles in the UI): https://www.netlifycms.org/docs/configuration-options/#identifier_field

Upvotes: 1

Related Questions