decap-cms icon indicating copy to clipboard operation
decap-cms copied to clipboard

Nested collections: Folder names in sidebar show first file's title instead of actual folder name

Open pranaysahith opened this issue 4 months ago • 2 comments

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


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']

pranaysahith avatar Oct 31 '25 23:10 pranaysahith

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!

seungyeons2 avatar Nov 03 '25 05:11 seungyeons2

@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?

pranaysahith avatar Dec 03 '25 16:12 pranaysahith