Netlify-cms: Folder-type collections with custom file extensions break if they are non-markdown.

Created on 30 Oct 2017  路  3Comments  路  Source: netlify/netlify-cms

- Do you want to request a feature or report a bug?
bug

- What is the current behavior?
If you use a folder-type collection with a non-markdown format (YAML, TOML, or JSON), as well as a custom file extension that does not match the format (extension .customext for YAML format).

- If the current behavior is a bug, please provide the steps to reproduce.

  1. Use the example site.
  2. Set format: yaml and extension: customext on a collection.
  3. Create a new entry in the collection (this should work).
  4. The entry cannot be edited (content appears to be missing). Console error is "Error: Unrecognized front-matter format."

- What is the expected behavior?
The entry should be able to be edited.

- Please mention your CMS, node.js, and operating system version.

CMS 0.6.0

bug

All 3 comments

This is caused by this code:
https://github.com/netlify/netlify-cms/blob/2c19c221e7828eacd93f2620faa384891551c1ea/src/formats/formats.js#L42-L46

If an entry already exists, the format will be determined by the file extension instead of the defined format.

@erquhart @Benaiah I'm just wondering if we should use the collection-defined format as the default, and fall back to the file extension, instead of the other way around.

@tech4him1 I agree - the explicitly set format should take precedence.

Was this page helpful?
0 / 5 - 0 ratings