decaporg / decap-cms

A Git-based CMS for Static Site Generators
https://decapcms.org
MIT License
17.67k stars 3.03k forks source link

Validation Error When Using Only Relative Media Directories #3670

Closed Undistraction closed 4 years ago

Undistraction commented 4 years ago

Describe the bug The beta docs here outline how collection-specific media_folder keys can allow you to use relative paths. This effectively removes the need for a global media_folder key. However it appears this is still being validated as a required key.

Error loading the CMS configuration Config Errors: config should have required property 'media_folder' config should have required property 'media_library' config should match some schema in anyOf Check your config.yml file.

I think there might be some kind of conflict between local and global dirs causing the bug I have outlined in decaporg/decap-cms#3654 which is why I removed the global dir.

To Reproduce

Expected behavior No validation error.

Screenshots

Applicable Versions:

erezrokah commented 4 years ago

Hi @Undistraction, the global media_folder is required for collections that don't have media_folder specified and also since you can use templates to refer to refer to the global one, e.g. under a collection you can specify media_folder: {{media_folder}}/posts_images (this is not document yet though).

Undistraction commented 4 years ago

@erezrokah Thanks for the explanation. That's a nice feature (being able to organise images within a central media directory).

I know that relative media directories are only a beta feature but would be great to add something to the docs highlighting that a global for is still required in the config even of you aren't using it.

erezrokah commented 4 years ago

Good point @Undistraction, we've recently added the media folder templating and field based media folders. It is not even documented yet since we want to gradually gain confident with the current approach and get more use cases. Closing this issue, as will open a new one to improve the docs.

erezrokah commented 4 years ago

Opened https://github.com/netlify/netlify-cms/issues/3671, please share your thoughts there and let me know if I missed something.