0

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?

Manuel Meurer
  • 3,238
  • 6
  • 35
  • 50

1 Answers1

1

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

Shawn Erquhart
  • 1,820
  • 2
  • 17
  • 30
  • Thanks, setting the extension solved it! In the documentation it says "Netlify CMS will attempt to infer your settings based on existing items in the collection.", and since the folder contains only files with the suffix .yml, I assumed it would work without setting the extension explicitly. – Manuel Meurer Jun 06 '19 at 08:00
  • Nesting the attributes under the locale in the YML files doesn't work though, I had to change it to "de.title" and "en.title". – Manuel Meurer Jun 06 '19 at 08:01