Nested collections: Folder names in sidebar show first file's title instead of actual folder name
Describe the bug
In nested collections, the sidebar (collection tree) displays folder names based on the title field from the first markdown file's frontmatter within that folder, rather than showing the actual directory name. if nested.summary is set to {{dirname}}, it shows the complete path of the folder instead of immediate folder name.
To Reproduce
- Create 2 files, one with Folder1/file1.md and another with Folder1/file2.md. Add a
titlein frontmatter of one of the files. e.g.title: File. - Open Decap CMS with provided config
- See the sidebar shows the title of the first markdown file instead of the folder name.
Expected behavior
The names in sidebar(collection tree) should display the folder names. Provide a template to pass to nested.summary.
Screenshots
Applicable Versions:
- Decap CMS version: 3.8.4
- Git provider: Azure
- OS: Ubuntu 24
- Browser version: Chrome Version 141.0.7390.108 (Official Build) (arm64)
CMS configuration
publish_mode: simple
site_url: https://docs.example.com
display_url: https://docs.example.com
show_preview_links: false
media_folder: "docs-site/static/.attachments/"
public_folder: "/.attachments"
collections:
- name: "docs"
label: "docs"
folder: docs-site
create: true
extension: 'md'
summary: "{{dirname}}/{{filename}}.{{extension}}"
fields:
- { label: "Title", name: "title", widget: "string", required: false }
- { label: "Body", name: "body", widget: "markdown", required: false }
- { label: "Sidebar position", name: "sidebar_position", widget: number, value_type: int }
- { label: "Tags", name: "tags", widget: "list", required: false }
nested:
depth: 10
subfolders: false
sortable_fields: ['commit_date', 'title', 'commit_author', 'sidebar_position']
Hi @pranaysahith ,
I'm working on a school assignment that involves contributing to an open-source project, and this issue caught my interest.
Could you please assign it to me? I’d love to work on it.
Thank you!
@martinjagodic I understand currently folders in nested collection need an index file. Me and few others who commented in the issues want to have the tree name based on the folder name without relying on the index file. Have you ever heard this use case and do you plan to introduce any config to remove the need for index file?