-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
content in subfolders… #513
Comments
Netlify CMS doesn't currently support sub-folders. I think there has been some discussion around this though, and I'm sure it would be a welcome improvement. If you want this final folder structure, I might suggest using metalsmith or gulp to create such a structure from a structure netlify-cms will work with. I'm currently using metalsmith, and here's what I get. Starting Files:
Finished Files:
|
ok… |
@kevinfoerster you can use a "file" type collection, and use the full path to each file. Here's an example: https://github.com/netlify/netlify-cms/blob/master/example/config.yml Having to repeat the config for each file is not ideal, so @tortilaman's approach is ideal. |
Finding a way to support this is worthwhile, reopening. |
Just to say from personal experience, indeed having a step which flattens the files works well at this stage. |
I'm wondering if we can resolve this with more advanced slug handling, maybe as a part of #445. The idea would be to allow the "slug" property to optionally be a path, which would be appended to the folder collection's base path. So to serve @kevinfoerster's example, it could look like: name: products
folder: products
slug: /{{slug}}/index.md
... Thoughts? cc/ @marksantoso |
Hi @erquhart this would result in a collection with many items. Providing not much structure for the user. E.g. Say you have a collection for 'pages', if you were to use the slug to manage subpages of pages you would end up with 1 collection with multiple pages, but no easy way to distinguish where they sit in the page hierarchy. subpages would sit in the same interface as their parent pages. This would also mean all items in this pages collection would hold the same fields, not ideal if various pages need different fields. Possibly another config type is required: Collections with subcollections? |
@marksantoso this is specifically for repeatable content - items that have the same general format and share the same field structure, e.g. blog posts. For distinct pages as you're describing, you'd still want to specify individual files. |
Hi, trying out Netlify-cms for the first time and having the same issue. My build script (using Assmble.js 0.24.3) uses a source directory where all my content is organized hierarchically. This hierarchy determines the paths of the generated html files, and the navigation (with drop-downs, sidebars, etc.) Prose.io seems to handle this quite well, showing a collection's files and directories and allowing the user to define the path right in the interface. I'm wondering what's preventing Netlify-cms from doing the same? Having one flat directory for all my pages is a nonstarter. I'd love to have all the additional features this CMS provides (workflows, previews and most importantly authentication) but my whole way of building websites depends on using subfolders. |
@criticalmash Have you thought about making each folder it's own collection? |
@tech4him1 That might work! Thanks. It would mean creating a new collection every time the client wants a new directory. But in that case, I'd need to adjust the main nav anyway. |
Hey all, I was wondering if this also included images stored in sub-folders of your |
I answered this in Gitter, but for posterity, assets need to be stored directly within the media folder. We do intend to allow multiple asset collections in the future. |
Hi @erquhart, excellent work on Netlify CMS (and the entire Netlify team, as well) - I can open a quick issue, but I think this is actually the same issue as @kevinfoerster. We store our blog posts (and authors) in nested folders, like
and then inside of each folder, we use the slug title as a folder. We do this so we can easily add other data (images mostly, for now!) while keeping the underlying file structure pretty clean and organized. This leaves us a folder structure like:
As best as I can tell, I can not create this structure currently with netlify-cms. I believe this is primarily because the folder attribute does not currently support templating like the
Is this a feature that you think is worthwhile? If so, I'd love to chip in and help get this built out, but I'm not quite sure where to start. Been perusing this repo in an attempt to start to get up to speed. Any advice on that would be hugely appreciated! Thanks for your time. |
@DSchau yep, that's a great point. Also, @marksantoso, I now see I misread what you meant. Sounds like folder collections should be able to accept a That's the direction that makes the most sense at the moment. I'd love feedback from both of you in light of your own use cases. cc/ @tech4him1 @Benaiah @talves @biilmann - especially interested in reasons not to go this route. Note that I'd expect this to mostly affect the configuration and UI surfaces, the underlying collections model would remain flat. |
I see two separate feature requests here (that I think should be split out into separate issues):
|
@tech4him1 agreed, we should split off "nesting collections in the UI". #1156 is in that vein, maybe we could expand that to cover the full nested collections concern. Possible short term solutionWorking on a solution for single level nested directories, it's shaping up like this: folder: my/folder
slug: {{slug}}/whatever Which would output something like
Proposed long term solutionI'd like to see us simplify this whole thing down to a single # The most explicit approach would be defining a full path:
path: my/folder/{{slug}}/index.md
# But you can keep it simple and we'll give you a derived slug and default
# extension/format (markdown):
path: my/folder
# Types are inferred for recognized extensions
path: data/stuff.yaml
# One additional field, `format`, is accepted for unrecognized extensions or
# formats that don't match the extension:
path: data/stuff.myext
format: json
# Now you can do whatever you want:
path: nested/dir/{{slug}}/index.pt.md Thoughts? Especially looking for reasons why these solutions might not work. |
@erquhart As a technical description of how the
|
I am also seeking this feature for a Wordpress blog I'm migrating to NetlifyCMS. |
@erquhart , this feature ({{slug}}/whatever) along with images relative to content would work really well with Gridsome too: storing collections in separate, self-contained subdirectories is a really nice way to organize a site with large collections. I could help with implementation if you point me in the right direction. Thanks, Ricardo |
Not intending to pile on. Google brought me here, and I thought it might be worth dropping in: I was very excited to fire up Netlify CMS, and then saw most of my posts missing. I prefer to use a structure like I definitely understand how that makes media management and configuration a potential nightmare, but I'd looooooove the ability to do this. I'll definitely have a look around and see if I have time to try to contribute something, if that's a welcome feature for Netlify CMS. |
Loud and clear. This is literally up next, hold tight. Sent with GitHawk |
I'm confused.. what's the status of this issue?? |
@theBliz that's the status ☝️ |
I've seen it but "next" does not specify a timeframe. Are we talking about a week or a month? More precisely, should I apply one of the workarounds suggested in the thread or should I wait a few days? |
If I had to throw out a timeframe, I’d say a month. That’s an estimate, not a commitment. Sent with GitHawk |
thanks @erquhart 👍 I'll check some of the workarounds in the meantime |
Just started using Netlify CMS, and this was literally the first thing I was trying to do |
@erquhart Heyo! I see this issue is fixed, any info on how we can get it and use it? Sorry for being annoying, but this is kinda urgent for me! Edit: It's already in beta, switch to netlify-cms@2.10.0-beta.4 |
@omfgnuts can we see how we can use this feature? a lot of discussion was so I'm a bit confused which one it is :) thanks! |
I think this feature is only compatible with the editorial workflow, or at least that's how I got it working. |
Hi @nonlinearcom with the latest version of the CMS this is also supported with the simple workflow. |
hi @erezrokah are there any docs about this? maybe would be nice also for others to see this. thanks! |
Hi @themre docs are under the beta section https://www.netlifycms.org/docs/beta-features/#folder-collections-path |
For those who need fully recursive nested collections without a predefined limit on the level/path template, check out https://www.netlifycms.org/docs/beta-features/#nested-collections (thanks to @erezrokah once again!) |
I came across this issue while trying to integrate Netlify CMS with my Hugo site, and I ended up using both Thanks to everyone who chipped in / worked on this, really great work ❤️ |
Wanted to see if there was anyway I could help with this. Beta nested feature just shows empty folders. Found this page from a DDG search. Looks like it should still be open. Trying the beta nested feature the folders show up but some directories are empty. Using Jekyll I can set the permalink on these pages and give whatever permalink to build. But unless they're in the _pages collection folder they can't be reached and edited through the CMS Content structure is like posts pages Thank you all for the hard work this is such a great tool to be using! Want to be able to implement this and spread the joy! |
it is not very obvious and maybe impossible, ist there a way to have collections with subdirectories?
currently I have a folder called products and in there several product folders with their index.md respectivly.
the title of the folder corresponds with the title in each index.md
netlify-cms does not parse the subfolder and/or does not list any content.
the collection is configured using this
folder: "src/pages/products/
is that even possible?
The text was updated successfully, but these errors were encountered: