Netlify-cms: Frontmatter should retain unknown fields

Created on 4 May 2018  路  8Comments  路  Source: netlify/netlify-cms

Currently, frontmatter fields not defined in the fields option are removed when editing a file.
I don't know the rationale behind this behaviour, but to me (and others #1174) it is highly unexpected. This can easily break things when intended frontmatter configuration gets silently stripped off with no immediate benefit.
In my opinion it would make more sense to simply ignore and keep frontmatter fields the CMS doesn't know about.

I often use frontmatter fields to define specific configuration of a page that is not supposed to be editable through the CMS. While it is possible to add hidden fields for that, it seems highly unnecessary - and is very tedious if you have to repeat multiple hidden fields for each file in a file collection. And it's still error prone because you easily forget to add a custom field name to the config. When somebody edits that file through the CMS, it's broken.

file-handling feature pinned 2.0 accepted

Most helpful comment

I was hoping to get a PR out for this today, but got pulled into something else. I have the logic ready to go, just need to write a test for it before put the request in. Hoping to have this ready for review by next week!

All 8 comments

I think this would be great, and seeing we are getting ready for 2.0, we should probably add it then.

Agreed.

I was hoping to get a PR out for this today, but got pulled into something else. I have the logic ready to go, just need to write a test for it before put the request in. Hoping to have this ready for review by next week!

I just got bit by this yesterday - the navigation on our site is driven by "interesting" fields in the frontmatter that I hadn't understood fully until I had to debug where all the nav items went and found the diffs from the CMS removing this:

menu:   
    main:   
        parent: aboutmenu

so - +1 for this someday :)

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

I still think this is an important feature and there are quite a few supporters. Just waiting for someone to implement it...

Thanks @straight-shoota I marked this one as pinned so it won't get marked as staled again.

I would need this as well.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marcojakob picture marcojakob  路  3Comments

ciokan picture ciokan  路  3Comments

papandreou picture papandreou  路  3Comments

Narno picture Narno  路  3Comments

BerkeleyTrue picture BerkeleyTrue  路  3Comments