trilium icon indicating copy to clipboard operation
trilium copied to clipboard

ShareTemplate: Link not available with attribute #shareHiddenFromTree

Open DonniDoc opened this issue 4 months ago • 1 comments

Description

  1. Create a note, share it and set owned attributes #shareHiddenFromTree.
  2. Open the link of the shared note.

Error: `

   
message ejs:193\n 191| \n 192| <% if (hasTree) { %>\n >> 193| <%- include("prev_next", { note: note, subRoot: subRoot }) %>\n 194| <% } %>\n 195| </footer>\n 196| </div>\n\nejs:1\n >> 1| <%\n 2| // TODO: code cleanup + putting this behind a toggle/attribute\n 3| const previousNote = (() => {\n 4| // If we are at the subRoot, there is no previous\n\nCannot read properties of undefined (reading 'hasVisibleChildren')
`

Is it really intended that a note cannot be opened directly via a link when #shareHiddenFromTree is set?

TriliumNext Version

0.100.0

What operating system are you using?

Ubuntu

What is your setup?

Server access only

Operating System Version

docker image on Ubuntu 24.04.3

Error logs

No response

DonniDoc avatar Dec 09 '25 11:12 DonniDoc

It is not intended that notes with the #shareHiddenFromTree attribute are inaccessible via direct link—this attribute is only supposed to hide notes from the navigation tree in shared views, but they should remain accessible by their URL (docs, maintainer comment).

The error you’re seeing (Cannot read properties of undefined (reading 'hasVisibleChildren')) is a bug in the EJS template logic for shared notes. When #shareHiddenFromTree is set, the navigation and footer logic can end up with undefined references because the template assumes all notes are present in the tree, but hidden notes are filtered out. This causes the template to try to call methods on undefined objects, resulting in the error (template code, footer nav logic).

As a workaround, you can either restructure your shared tree so that private notes are outside the shared subtree, or use protected notes for sensitive content (workaround discussion). This bug is not yet fixed in recent releases.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

dosubot[bot] avatar Dec 09 '25 11:12 dosubot[bot]