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 collection of JSON data files saves files in markdown format #748

Closed
verythorough opened this issue Oct 27, 2017 · 2 comments · Fixed by #830
Closed

folder collection of JSON data files saves files in markdown format #748

verythorough opened this issue Oct 27, 2017 · 2 comments · Fixed by #830
Assignees

Comments

@verythorough
Copy link
Contributor

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

  1. Log in at https://postman-toad.netlify.com/admin/ (Registration is open, and you can use your GitHub account.)
  2. Add a new JPost.
  3. Check your new file in the repo, and see that it is a JSON file, with yaml frontmatter contents.
    (I removed the 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

@tech4him1
Copy link
Contributor

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?

@verythorough
Copy link
Contributor Author

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.

@tech4him1 tech4him1 self-assigned this Oct 30, 2017
@tech4him1 tech4him1 changed the title folder collection of data files saves files in markdown format folder collection of JSON data files saves files in markdown format Nov 10, 2017
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