Nested collections: Folder names in sidebar show first file's title instead of actual folder name
- Dominant language
- JavaScript
- Stars
- 19.4k
- Forks
- 3.1k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 9
Description
**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**
1. Create 2 files, one with Folder1/file1.md and another with Folder1/file2.md. Add a `title` in frontmatter of one of the files. e.g. `title: File`.
2. Open Decap CMS with provided config
3. 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**
```yaml
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']
```
Contributor guide
Assessment
This issue has not been assessed yet.