Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Folder-type collections with custom file extensions break if they are non-markdown. #763

Closed
tech4him1 opened this issue Oct 30, 2017 · 3 comments · Fixed by #795
Closed
Assignees

Comments

@tech4him1
Copy link
Contributor

- 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

@tech4him1
Copy link
Contributor Author

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.

@tech4him1
Copy link
Contributor Author

tech4him1 commented Oct 30, 2017

@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.

@Benaiah
Copy link
Contributor

Benaiah commented Oct 30, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants