Closed verythorough closed 6 years ago
Normally you should be able to do extension: json
and format: json
to get it to work. This is broken for JSON specifically, and should be fixed.
It does bring up an interesting issue, though: Instead of failing on an unsupported format, we just assume that it should be a markdown post. What do you think of just issuing a config error on an unsupported format, as an "Invalid Config" error. Or we could do it more gently, and just break that collection instead of the entire CMS? @erquhart @Benaiah?
Interesting about having separate extension and format fields. I started thinking about cases where you'd have different values for each, and realized it might be a handy way to specify different frontmatter formats. (We can read yaml/toml/json frontmatter, but only write yaml.) For example, extension: md
and format: toml
would make a markdown file with toml frontmatter. Might be overgeneralizing, though, leading to more confusion than it's worth.
- Do you want to request a feature or report a bug? bug, unless I've missed a setting
- What is the current behavior? Folder collections save files in markdown (with yaml frontmatter) by default. You can change the file extension by adding the
extension
field to the collection config. This causes files in the folder to be saved with the chosen extension, but the file contents are still in markdown with yaml frontmatter.- If the current behavior is a bug, please provide the steps to reproduce.
body
field from the config, thinking that it might be triggering the markdown format. You can see my first test, with body field intact, here.)- What is the expected behavior? The contents of the file should match the extension.
- Please mention your CMS, node.js, and operating system version. 0.5.0 in a one-click-hugo-cms deploy, running on current Chrome