decaporg/decap-cms

Directory navigation in the media library

erquhart opened this issue Β· 24 comments

Is your feature request related to a problem? Please describe.

This feature would be extremely useful in general, but is a requirement for the following common use case:

  • A markdown collection has existing entries
  • Images in the bodies of those files come from multiple directories
  • The best the CMS can do currently is show one configured directory in the media library for the entire collection
  • Images that are not sourced from the configured directory aren't visible
  • Even if we made it so they were visible, the directories they point to are still inaccessible from the media library

Describe the solution you'd like

For sites of any complexity, Eg., large existing open source docs sites, which Open Authoring was created for, navigating directories in the media library is a necessity.

From #1046 (comment):

Requirements

  • Allow multiple folders to be used
  • Allow nested folders
  • Allow users to create folders

Proposed approach

  • Keep accepting a single media folder in the config, as we do currently
  • Show a list of folders found within the media folder on the left side of the media library
  • Use breadcrumbs to track position in the hierarchy
  • Allow new folders to be created via an input after the last folder in the list with placeholder "new folder"
  • Allow folders to be deleted via a button that shows on hover of each folder
  • Folders must be empty to delete

Describe alternatives you've considered

No support.

Additional context

Replaces #1046.

We're building a content portal for a client, where different publishing partners would add articles to their own collections. Each publisher should only be able to see their own content, but our client should be able to see everything. To accomplish this, we're going the route of creating multiple CMS instances, each configured to access only a subset of the content files - seems to work like a charm... except when it comes to the media library.

If I set the media_library to /static/assets/<publisher-name> then each publisher can only see the images they upload - good. For the client, I'd want to set the media folder to /static/assets and have all the sub-folders in that directory appear.

@erquhart - Sounds like this would be totally possible based on your description above. Is this likely to drop anytime soon? I could potentially get one of my developers to help out if you have a clear solution in mind?

Hi @andy-mcdonald, we try to work our way through the most up voted issues first, but of course open to any contribution.

Currently we list media files based on the media folder up to a depth of 1, but that can be changed (example for GitHub) here:
https://github.com/netlify/netlify-cms/blob/2409323dba1abe8a670d18453369fd75c6e240fb/packages/netlify-cms-backend-github/src/implementation.tsx#L377

Media library components can be found here:
https://github.com/netlify/netlify-cms/tree/2409323dba1abe8a670d18453369fd75c6e240fb/packages/netlify-cms-core/src/components/MediaLibrary

Another option it to incorporate it into the general UX overall here

@erezrokah - Thanks for the update, we'll look into this alongside some of the other contributions we'd like to make.

@andy-mcdonald, if you do start actively working on something, please let us know so we can assign it to you so people know it is taken :)

@andy-mcdonald woot!! πŸŽ‰

bugii commented

Such a cool feature :) Any update on this?

This feature seems like a very important addition.

Is anyone actively working on this? Any view on timescale?

Thanks.

Hi @neilmorton, Netlify CMS is a community driven project, this is not on the radar at the moment but we would love a contribution for it.

Hi @erezrokah, thanks for the heads up. I'd be interested if @andy-mcdonald did anything with this.

I think this is a must have feature for netlify cms, since in most big projects, images are organized in subfolders.

I know this can take some time to implement. But is it possible to prioritize this?

hit the same need. Hopefully we can see this feature soon~!

@franva and @surjithctly if you haven’t already, make sure to up vote the original post, as they tend to work on the most up voted issues first. πŸ‘

sure @neilmorton what's the original post? so do you mean that we already have this feature implemented? I'd love to see it~!

@franva I guess he meant the first comment of this issue where people did thumbs up πŸ‘

@franva, as @surjithctly has mentioned, add a thumbs up πŸ‘ to the first comment on this issue here if you haven't already done so.

The feature hasn't been implemented, but issues with more thumbs up πŸ‘ tend to get chosen for action.

Thanks @surjithctly

thanks @surjithctly and @neilmorton I have thumb-upped this issue πŸ‘

@erquhart having had a cursory look at the code, I would like to make an attempt at this, unless someone else is currently working on it?

Hi @andrew-paterson, we would love a contribution for this. Please know that this will require a fair amount of work. Regardless I recommend looking at #2557 as I think it would be best to include this issue as a part of that effort.

I have created #4670 as a very small first step. I'd like to clarify a few things, which I have listed in the PR before continuing.

5310 commented

It's been a while since there's been any activity on this. Are you guys still planning to add filesystem navigation in the media library? It'd really help nested collections reuse assets for subpages 😊

I would love this!

It wouldn't address the arbitrary or nested subfolders use case, but has anyone considered changing the main media tab to bring up the same collections menu as Contents, when multiple media folders are configured against the content collections?

The media lightbox could then popup with the relevant directory view only after a content type was selected from the left menu. It feels like most of the code to achieve this should already exist, given the content editors do this under the hood today.

(A virtual content type would probably have to be added to the top of the menu representing the default global media location.)

Alternatively, a global config option to optionally have the Media tab lightbox use the media folder for the currently selected content type.

Issue linked with: #2113
(In that one a broken link to netifycms is posted as an answer)