Updated Sharing (markdown)

zadam 2022-01-02 22:23:58 +01:00
parent 72e8150acf
commit 05b23df6ae

@ -1,6 +1,6 @@
Since v0.49 Trilium offers a feature to share selected notes as publicly accessible read only documents.
Basic prerequisite for this feature is to have a [[server installation]] - this is where the notes will be hosted from.
The basic prerequisite for this feature is to have a [[server installation]] - this is where the notes will be hosted from.
## Share note
@ -28,16 +28,22 @@ You can see a basic navigation on the right. With this you can create small webs
### Styling the shared notes
The default shared page is pretty rudimentary. In case you want to style it more nicely you can:
The default shared page is pretty rudimentary. In case you want to style it more nicely, you can:
* add a `~shareCss` relation to a CSS code note which will be linked in the shared page
* in case you want this to apply to the whole subtree, don't forget to make the label inheritable
* the linked CSS code note needs to be also in the shared subtree. If you want to hide it from left tree navigation, add `#shareHiddenFromTree` label to the CSS code note.
* if you make extensive styling changes then it's recommended to use `#shareOmitDefaultCss` on the shared subtree so that you don't need to override default stylesheet (this will also avoid problems in the future when the default CSS changes).
* if you make extensive styling changes, then it's recommended to use `#shareOmitDefaultCss` on the shared subtree so that you don't need to override the default stylesheet (this will also avoid problems in the future when the default CSS changes).
### Scripting
It's possible to inject a JavaScript note to the shared note using `~shareJs` relation.
In case you want to access e.g. attributes or traverse the tree in the linked JavaScript note, you can use the API available through global [`fetchNote(noteId = current)` function](https://github.com/zadam/trilium/blob/master/src/public/app/share.js).
### Creating human-readable URL aliases
Shared notes are accessible using URLs like `http://domain/share/knvU8aJy4dJ7`, where the last part is note's ID.
Shared notes are accessible using URLs like `http://domain/share/knvU8aJy4dJ7`, where the last part is the note's ID.
You can add `#shareAlias` to individual notes to make the URLs nicer, e.g. `#shareAlias=highlighting` will make the URL look like `http://domain/share/formatting`.
@ -56,7 +62,6 @@ Shared notes functionality is compared to standard functionality very limited.
The not exhaustive list of **what is missing** is:
* relation map support
* scripting
* book notes show only children note list
* code notes have no highlighting
* note tree is static