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
Setting content extension or filename to json allows editing but fails to list #13
Comments
My settings look like this:
|
Can you give me a sample file that you'd like to save? I've just finished preparing a new release that I think should cover your use case. Right now collections assume you have a frontmatter format, it doesn't really allow you to have a collection of pure JSON files. |
BTW, |
Hey, thanks for looking into this. Doesn’t frontmatter translate directly to JSON key value? And then there are also title and body? Smth like this:
I think specifying "format" as JSON should be enough for the filename to pick up saving it as json, but if it’s possible to set that via |
You can save JSON files now; content:
- name: posts
label: Posts
path: content/posts
filename: '{year}-{month}-{day}-{primary}.json'
type: collection
view:
fields: [ title, published, date ]
fields:
- name: published
label: Published
type: boolean
default: true
- name: date
label: Date
type: date
- name: title
label: Title
type: string
- name: body
label: Body
type: rich-text Using this config I was able to save the following post: {
"published": true,
"date": "2024-02-29",
"title": "This is my first JSON entry",
"body": "_Hello_ **world**!"
} It shows properly in the collection as well. |
Looks like it’s fixed! Thanks! |
Hey, awesome work on this!
I want to use .json to store the contents. Setting filename property works and correctly opens editor and saves files, however, the listing on collection subview is doesn’t pick up the titles and there is an error shown about front matter:
The text was updated successfully, but these errors were encountered: