Skip to content

Initial support for Folder Notes#341

Open
PrOF-kk wants to merge 1 commit intooleeskild:mainfrom
PrOF-kk:dg-folder-notes
Open

Initial support for Folder Notes#341
PrOF-kk wants to merge 1 commit intooleeskild:mainfrom
PrOF-kk:dg-folder-notes

Conversation

@PrOF-kk
Copy link

@PrOF-kk PrOF-kk commented Jan 11, 2026

For folders with folder notes the click target to open the folder instead of navigating to the folder note is just the '>' icon, we should consider making it bigger.
Also, there's currently no "active-note" highlighting for folder notes, and the link doesn't have the typical underline on hover.
Even so it works pretty well overall, and I didn't notice any increase in build times.

Tested on my personal vault which uses LostPaul/obsidian-folder-notes

Closes oleeskild/obsidian-digital-garden#237
Closes oleeskild/obsidian-digital-garden#669

@oleeskild
Copy link
Owner

oleeskild commented Feb 28, 2026

Thanks! I think it makes sense for the plugin to support folder notes out of the box like this. A few thing I'd like to see fixed before merging it in.

Site logo regression

The current main has a conditional block in filetree.njk that renders a site logo when meta.siteLogoPath is set. This PR replaces it with just an <h1>, which would break that feature. Looks like the branch needs a rebase onto current main.

Recursion bug in detectFoldersWithFolderNotes

The function misses folder notes at certain nesting depths. It iterates entries of the passed object, and for each folder checks its children. But when it recurses on a child folder via else if (child.isFolder), the recursive call makes that
folder the new root — and its own note never gets checked against its name.

Example: with A/A.md/B/B.md/C/C.md, A and C get detected but B does not.

Fix would be to always recurse into folders separately from the matching logic:

  function detectFoldersWithFolderNotes(tree) {
    for (const [name, entry] of Object.entries(tree)) {
      if (entry.isFolder) {
        for (const [childName, child] of Object.entries(entry)) {
          if (child.isNote && childName === name + ".md") {
            child.hide = true;
            entry.folderNote = child;
          }
        }
        detectFoldersWithFolderNotes(entry);
      }
    }
  }

Also a minor nit: missing semicolon on fileOrFolder.folderNote = child.

@PrOF-kk
Copy link
Author

PrOF-kk commented Mar 1, 2026

Rebased and simplified the recursion code, dropped the style reformat commit, tested on my personal vault.
It's also probably faster now since there are no nested loops but I doubt it'll be noticeable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Folder Notes [Feature Request] Folder note support

2 participants