zadam / trilium

Build your personal knowledge base with Trilium Notes
GNU Affero General Public License v3.0
27.2k stars 1.9k forks source link

(Feature request) #shareRoot attribute that serves as the note when https://[url]/share/ is visited #2567

Closed sigaloid closed 2 years ago

sigaloid commented 2 years ago

Describe feature

This would make it easier to host a wiki as it would be possible to host it at https://[url]/share/ rather than an arbitrary note ID or short alias. For those trying to host Trilium as a single function site rather than individual shared notes, it would be a helpful feature

Additional Information

PS: I attempted to add this but it's really hard to do so when I can't tell what functions are associated with a type or what is in scope. What IDE do you use, and do you use any extensions during development?

zadam commented 2 years ago

Hi, I don't understand what's the use case/need here - why not just have e.g. https://[url]/share/index and all the notes you want to share there?

PS: I attempted to add this but it's really hard to do so when I can't tell what functions are associated with a type or what is in scope. What IDE do you use, and do you use any extensions during development?

I use Intellij IDEA Ultimate. WebStorm should also do the trick.

tanpengsccd commented 2 years ago

Can I share 'Root -> Shared notes' this node as only one link like https://[url]/share/index ?

sigaloid commented 2 years ago

The Shared Notes note cannot be shared, no. Sharing a note for a single-function site would require a child note there, then sharing it as /share/index.

Hi, I don't understand what's the use case/need here - why not just have e.g. https://[url]/share/index and all the notes you want to share there?

It would make it easier to redirect, in the case of making it a proper site - being able to redirect /share/ as / and /^share as /admin/ (or whatever) in the web proxy. TLDR: it would allow people to just visit https://[url]/ and see your website's shared content immediately, whereas you would be able to log in at /admin/ for the actual Trilium instance. In the case of /share/index, you would have to redirect to it and the /share/ would always be there, whereas having a shareRoot attribute would allow just /share/ to be shown as clean urls with nothing else attached to it on the main page (and bare ID's like https://[url]/[id] rather than /share/).

zadam commented 2 years ago

Hi, got it. It would be probably possible to devise URL rewriting rules to work around that, but it would be quite complicated.

Added to master / future 0.50.

sigaloid commented 2 years ago

Awesome, thanks :smile: