Is your feature request related to a problem? Please describe.
I'm always frustrating when, by defining even a relatively small number of collections, I ended up with a gigantic config.yml which is not manageable at all.
Describe the solution you'd like
I'd like to be able to break down config.yml in small pieces (i.e. yml files).
Those yml files could live in a config subdir of static/admin directory. Then NetlifyCMS should be able to merge them all together no matter how deep is the config tree.
Describe alternatives you've considered
The alternative would be to add a step in the build process to create a gigantic yml file composed of the smaller ones.
Additional context
This could be very helpful in migrating data intensive website with a lot of collections (i.e. DB table like structure and relationship).
What if we split files into collections like this?
admin/
config.yml
collections/
authors.yml
pages.yml
posts.yml
products.yml
It's ok. But we should allow even a more deeper tree. Than NetlifyCMS should merge them all.
config.yml
folder/
posts.yml
files/
products.yml
and so on.
@magomimmo I am not sure I see the value in separating things that way. In each collection file, you are able to specify the collection type anyways.
@austincondiff IMHO any kind of classification is subjective. If we take any set of things, the way I would classified them will be probably different from you own way. Directory/Subdirectory structure is a way of classifying things. The more freedom you leave to classification the more ways people will find of classifying things. I was not saying that the folders have to be named after the kind of collections they includes. I was saying that there are more way of classifying the same things. So just let the developer to decide following her/his preferences. I think that if you allow recursive merging between yaml files, you leave more room for any kind of classification. That's why I was thinking about config as the main directory containing anything else. If the design is very simple, you'll use config.yml only. If the design has more complexity, you could organize your yml files in the way you want in a config directory.
Can we track this under https://github.com/netlify/netlify-cms/issues/1342?
Regardless one can use YAML aliases as shown here:
https://github.com/netlify/netlify-cms/blob/72b26f4435b428f79805920566678627e60fffaa/website/static/admin/config.yml#L38
Or switch to JavaScript which allows using multiple files, see example (for JS, not multiple files):
https://github.com/Axway/axway-open-docs/blob/ea8265d4a9ba7087c4fbae1092be9ca963ce1373/static/admin/config.js#L47
Hi @erezrokah, even if it coulb be a solution, I don't think it's the one I had in mind. Aside from configuring backend and few other thing, we mainly use config.yml to model collections. As I said in other issue, I'm evaluating NetlifyCMS for migrating a database intensive application. If it's true that we want to be the wordpress of the JAMstack approach, we should make the modeling of the collections as natural and simple as possible, like in the context of database modeling. Modularize the definition of collections to me means to be able to isolate group of homogeneous collection in a folder with each collection in a specific yaml file. Even if the yaml alais let you easily duplicate content across your document, to me it does not solve the problem of making complicated collections model more modular. Obliviously this is only my opinion.
I agree there is benefit to multiple yaml files support.
You could still modularize the definition of collections using JSON files (instead of yaml) and have a JavaScript file that imports them and initialises the CMS.
FYI: My config.yml has more than 3K LOC, containing 7 folder collections and about 30 file collections organized into 4 files collections.
I fragmented the config.yml in pieces, using a yaml file for each folder collection and of each group of file collections.
I then used yq to merge all the yml files into config.yml file with the following command as a step of the build process:
yq m $(find ./cmsconfig -type f) -a > static/admin/config.yml
@erezrokah any updates on this?
Hi @fabich, I would consider this low priority as there are multiple workarounds.
For example:
config.yml from multiple files during a build step.We are open for a contribution, but first we would need to define how such support would look like.
Most helpful comment
What if we split files into collections like this?