Open rdtclark opened 4 years ago
Netlify CMS already supports YAML and JSON files, the Middleman starter includes examples of both markdown with middleman-blog
and yml files with dynamic pages. If you want to edit your entries in a single file, have a look at the file collection.
Thanks Tom.
I understood there is support for YAML and JSON already and the file collection but am I correct that you cannot create entries into a YAML file using the file collection?
I suppose an option if that is true is to create empty entries and mark them not visible until updated.
You can make a yaml list with the list widget: https://www.netlifycms.org/docs/widgets/list/
The list widget is an option but I am looking to create a number of products and need to add multiple images and fields for each. It would be ideal to keep a single products.yml file for other uses but I may have to concede in the end.
I had a conversation about this on the slack channel this week and it was suggested to put in a feature request.
Also as a beginner developer please excuse me while I get my feet wet.
I think the capability would be really useful across other generators like Gatsby for example.
Is this a realistic contender as a feature request?
Update, I have re-modelled the data structure using your Middleman starter.
Thank you. Works wonderfully.
I would still like to make a feature request to support creating and editing with single data file, but accepting the limitation.
Gotcha. I've updated the title for clarity. Glad to see it's working!
Been looking for it in the context of sourcing the content to Gatsby using JSON: https://www.gatsbyjs.org/docs/sourcing-content-from-json-or-yaml/
i also think a "single-file" collection type for list data would be great.
while "folder" collections are great for stuff like posts, and the "files" collection type for pages, i have been missing something for lists of data like "authors info".
to keep this in a single file the current workaround seems to be to have a file in a files collection with a single list widget inside. this however has a couple of disadvantages:
searchFields
seem not supportedJust making sure this isn't a duplicate of https://github.com/netlify/netlify-cms/issues/535
I think this feature can have two variations:
As in issue #535 where a file is designed to model a unique non repeating data (like Private Policy
, Contact Info
, etc).
As in this issue, a collection folder with multiple entries of the same type, written to the same file instead of multiple files. Resembles the list widget, but shows up as multiple entries in the CMS collection view (e.g. a products file).
yes exactly -- it's somewhat related to https://github.com/netlify/netlify-cms/issues/531
@erezrokah i've put together a hacky proof of concept how i think this could work. see https://github.com/netlify/netlify-cms/compare/master...stefanprobst:feat/single-file-collection
includes a simple demo, run with
yarn
yarn build
cp -r packages/netlify-cms/dist dev-test/dist/
npx netlify-cms-proxy-server
npx serve dev-test
open http://localhost:5000/test
Middleman has an excellent feature whereby you can generate all of your content via a single data file. If used in conjunction with Dynamic pages this becomes a beautifully simple yet powerful setup.
If Netlify CMS could support creating & editing these simple YAML or JSON entries that would be a highly leveraged way to author a static site while enabling easy access to other services & APIs.
I have considered more enterprise headless CMS solutions for example Prismic.io however it feels like overkill for this kind of use case.
This may be achievable with a new collection type "data" as a close cousin to the folder collection type.
Thank you for your consideration.