mirror of
https://github.com/zadam/trilium.git
synced 2025-11-06 05:15:59 +01:00
Merge remote-tracking branch 'origin/develop' into calendar
This commit is contained in:
@@ -15,7 +15,7 @@ New tasks are created in the TODO note which has `~child:template` [relation](..
|
||||
|
||||
### Attributes
|
||||
|
||||
Task template defines several [promoted attributes](../Attributes/Promoted%20Attributes.md) - todoDate, doneDate, tags, location. Importantly it also defines `~runOnAttributeChange` relation - [event](../../Note%20Types/Code/Events.md) handler which is run on attribute change. This [script](../../Scripting.md) handles when e.g. we fill out the doneDate attribute - meaning the task is done and should be moved to "Done" note and removed from TODO, locations and tags.
|
||||
Task template defines several [promoted attributes](../Attributes/Promoted%20Attributes.md) - todoDate, doneDate, tags, location. Importantly it also defines `~runOnAttributeChange` relation - [event](../../Scripting/Events.md) handler which is run on attribute change. This [script](../../Scripting.md) handles when e.g. we fill out the doneDate attribute - meaning the task is done and should be moved to "Done" note and removed from TODO, locations and tags.
|
||||
|
||||
### New task button
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Weight Tracker
|
||||

|
||||
|
||||
The `Weight Tracker` is a [Script API](../../Note%20Types/Code/Script%20API.md) showcase present in the [demo notes](../Database.md).
|
||||
The `Weight Tracker` is a [Script API](../../Scripting/Script%20API.md) showcase present in the [demo notes](../Database.md).
|
||||
|
||||
By adding `weight` as a [promoted attribute](../Attributes/Promoted%20Attributes.md) in the [template](../Templates.md) from which [day notes](Day%20Notes.md) are created, you can aggregate the data and plot weight change over time.
|
||||
|
||||
|
||||
@@ -1,77 +1,28 @@
|
||||
# Attributes
|
||||
<figure class="image"><img style="aspect-ratio:1071/146;" src="Attributes_image.png" width="1071" height="146"></figure>
|
||||
|
||||
In Trilium, attributes are key-value pairs assigned to notes, providing additional metadata or functionality. There are two primary types of attributes:
|
||||
|
||||
1. **Labels**: Simple key-value text records
|
||||
2. **Relations**: Named links to other notes
|
||||
1. <a class="reference-link" href="Attributes/Labels.md">Labels</a> can be used for a variety of purposes, such as storing metadata or configuring the behaviour of notes. Labels are also searchable, enhancing note retrieval.
|
||||
|
||||
For more information, including predefined labels, see <a class="reference-link" href="Attributes/Labels.md">Labels</a>.
|
||||
|
||||
2. <a class="reference-link" href="Attributes/Relations.md">Relations</a> define connections between notes, similar to links. These can be used for metadata and scripting purposes.
|
||||
|
||||
For more information, including a list of predefined relations, see <a class="reference-link" href="Attributes/Relations.md">Relations</a>.
|
||||
|
||||
|
||||
These attributes play a crucial role in organizing, categorising, and enhancing the functionality of notes.
|
||||
|
||||

|
||||
## Viewing the list of attributes
|
||||
|
||||
## Labels
|
||||
Both the labels and relations for the current note are displayed in the _Owned Attributes_ section of the <a class="reference-link" href="../Basic%20Concepts%20and%20Features/UI%20Elements/Ribbon.md">Ribbon</a>, where they can be viewed and edited. Inherited attributes are displayed in the _Inherited Attributes_ section of the ribbon, where they can only be viewed.
|
||||
|
||||
Labels in Trilium can be used for a variety of purposes:
|
||||
|
||||
* **Metadata**: Assign labels with optional values for categorization, such as `#year=1999`, `#genre="sci-fi"`, or `#author="Neal Stephenson"`
|
||||
* **Configuration**: Labels can configure advanced features or settings
|
||||
* **Scripts and Plugins**: Used to tag notes with special metadata, such as the "weight" attribute in the <a class="reference-link" href="Advanced%20Showcases/Weight%20Tracker.md">Weight Tracker</a>.
|
||||
|
||||
Labels are also searchable, enhancing note retrieval.
|
||||
|
||||
### Common Labels for Advanced Configuration
|
||||
|
||||
* `disableVersioning`: Disables automatic versioning, ideal for large, unimportant notes like script libraries
|
||||
* `versioningLimit`: Used to limit the number of revisions for a single note
|
||||
* `calendarRoot`: Marks the note as the root for [day notes](Advanced%20Showcases/Day%20Notes.md). Only one note should carry this label
|
||||
* `archived`: Hides notes from default search results and dialogs
|
||||
* `excludeFromExport`: Excludes notes and their subtrees from export operations
|
||||
* `run`: Specifies events to trigger scripts (e.g., `frontendStartup`, `hourly`)
|
||||
* `runAtHour`: Defines specific hours for scripts to run, used with `#run=hourly`
|
||||
* `disableInclusion`: Prevents a script from being included in parent script executions
|
||||
* `sorted`: Automatically sorts child notes alphabetically by title
|
||||
* `top`: Keeps the note at the top of its parent's list, useful with `sorted`
|
||||
* `hidePromotedAttributes`: Hides certain attributes in the note's display
|
||||
* `readOnly`: Sets the note to read-only mode, applicable to text and code notes
|
||||
* `autoReadOnlyDisabled`: Disables automatic read-only mode for large notes
|
||||
* `appCss`: Marks CSS notes used to modify Trilium’s appearance
|
||||
* `appTheme`: Marks full CSS themes available in Trilium's options
|
||||
* `cssClass`: Adds a CSS class to the note's representation in the tree
|
||||
* `iconClass`: Adds a CSS class to the note's icon, useful for distinguishing notes visually. See <a class="reference-link" href="../Basic%20Concepts%20and%20Features/Notes/Note%20Icons.md">Note Icons</a>.
|
||||
* `pageSize`: Specifies the number of items per page in note listings
|
||||
* `customRequestHandler` **and** `customResourceProvider`: Refer to <a class="reference-link" href="Custom%20Request%20Handler.md">Custom Request Handler</a>
|
||||
* `widget`: Marks a note as a custom widget, added to Trilium's component tree
|
||||
* `workspace` **and related attributes**: See <a class="reference-link" href="../Basic%20Concepts%20and%20Features/Navigation/Workspace.md">Workspace</a> for more details
|
||||
* `searchHome`: Specifies the parent for new search notes
|
||||
* `inbox`: Designates a default location for new notes created via the sidebar
|
||||
* `sqlConsoleHome`: Default location for SQL console notes
|
||||
* `bookmarked` **and** `bookmarkFolder`: See <a class="reference-link" href="../Basic%20Concepts%20and%20Features/Navigation/Bookmarks.md">Bookmarks</a>
|
||||
* `share:[…]`: See <a class="reference-link" href="Sharing.md">Sharing</a>
|
||||
* `keyboardShortcut`: Assigns a keyboard shortcut to open the note
|
||||
* `displayRelations` **and** `hideRelations`: Manages the display of note relations
|
||||
* `titleTemplate`: See <a class="reference-link" href="Default%20Note%20Title.md">Default Note Title</a>
|
||||
* `template`: Makes the note available as a template
|
||||
* `toc`: Controls the visibility of the table of contents
|
||||
* `color`: Defines the color of the note in the tree and links
|
||||
* `hideChildrenOverview`: Hides child notes in the parent note's editor
|
||||
* `viewType`: Sets the view of child notes (grid or list)
|
||||
|
||||
## Relations
|
||||
|
||||
Relations define connections between notes, similar to links.
|
||||
|
||||
### Uses
|
||||
|
||||
* **Metadata Relationships**: For example, linking a book note to an author note
|
||||
* **Scripting**: Attaching scripts to events or conditions related to the note
|
||||
|
||||
### Common Relations
|
||||
|
||||
* **Event-based Relations**: Such as `runOnNoteCreation` or `runOnNoteChange`, which trigger scripts on specific actions
|
||||
* **Other Relations**: Include `template`, `renderNote`, `widget`, and sharing-related relations
|
||||
In the list of attributes, labels are prefixed with the `#` character whereas relations are prefixed with the `~` character.
|
||||
|
||||
## Multiplicity
|
||||
|
||||
Attributes in Trilium can be "multivalued", meaning multiple attributes with the same name can coexist.
|
||||
Attributes in Trilium can be "multi-valued", meaning multiple attributes with the same name can co-exist.
|
||||
|
||||
## Attribute Definitions and Promoted Attributes
|
||||
|
||||
|
||||
@@ -1,25 +1,38 @@
|
||||
# Attribute Inheritance
|
||||
## 1\. Standard Inheritance
|
||||
Inheritance refers to the process of having a [label](Labels.md) or a [relation](Relations.md) shared across multiple notes, generally in parent-child relations (or anywhere if using templates).
|
||||
|
||||
## Standard Inheritance
|
||||
|
||||
In Trilium, attributes can be automatically inherited by child notes if they have the `isInheritable` flag set to `true`. This means the attribute (a key-value pair) is applied to the note and all its descendants.
|
||||
|
||||
### Example Use Case
|
||||
To make an attribute inheritable, simply use the visual editor for <a class="reference-link" href="Labels.md">Labels</a> or <a class="reference-link" href="Relations.md">Relations</a>. Alternatively, the attribute can be manually defined where `#myLabel=value` becomes `#myLabel(inheritable)=value` when inheritable.
|
||||
|
||||
The `archived` label can be set to be inheritable, allowing you to hide a whole subtree of notes from searches and other dialogs by applying this label at the top level.
|
||||
As an example, the `archived` label can be set to be inheritable, allowing you to hide a whole subtree of notes from searches and other dialogs by applying this label at the top level.
|
||||
|
||||
## 2\. Copying Inheritance
|
||||
Standard inheritance forces all the notes that are children (and sub-children) of a note to have that particular label or relation. If there is a need to have some notes not inherit one of the labels, then _copying inheritance_ or _template inheritance_ needs to be used instead.
|
||||
|
||||
## Copying Inheritance
|
||||
|
||||
Copying inheritance differs from standard inheritance by using a `child:` prefix in the attribute name. This prefix causes new child notes to automatically receive specific attributes from the parent note. These attributes are independent of the parent and will persist even if the note is moved elsewhere.
|
||||
|
||||
### How to Use
|
||||
If a parent note has the label `#child:exampleAttribute`, all newly created child notes (one level deep) will inherit the `#exampleAttribute` label. This can be useful for setting default properties for notes in a specific section.
|
||||
|
||||
* **Syntax:** `#child:attributeName`
|
||||
* **Chained Inheritance:** You can chain this inheritance, such as `#child:child:attributeName`, where each child down the hierarchy receives the appropriate attribute.
|
||||
Similarly, for relations use `~child:myRelation`.
|
||||
|
||||
### Example
|
||||
Due to the way it's designed, copying inheritance cannot be used to cascade infinitely within a hierarchy. For that use case, consider using either standard inheritance or templates.
|
||||
|
||||
If a parent note has the label `#child:exampleAttribute`, all newly created child notes will inherit the `#exampleAttribute` label. This can be useful for setting default properties for notes in a specific section.
|
||||
### Chained inheritance
|
||||
|
||||
## 3\. Template Inheritance
|
||||
It is possible to define labels across multiple levels of depth. For example, `#child:child:child:foo` applied to a root note would create:
|
||||
|
||||
Attributes can also be inherited from [templates](../Templates.md). When a new note is created using a template, it inherits the attributes defined in that template. This is particularly useful for maintaining consistency across notes that follow a similar structure or function.
|
||||
* `#child:child:foo` on the first-level children.
|
||||
* `#child:foo` on the second-level children.
|
||||
* `#foo` on the third-level children.
|
||||
|
||||
Similarly, use `~child:child:child:foo` if dealing with relations.
|
||||
|
||||
Do note that same as simple copying inheritance, the changes will not apply retroactively to existing notes in the hierarchy, it will only apply to the newly created notes.
|
||||
|
||||
## Template Inheritance
|
||||
|
||||
Attributes can also be inherited from <a class="reference-link" href="../Templates.md">Templates</a>. When a new note is created using a template, it inherits the attributes defined in that template. This is particularly useful for maintaining consistency across notes that follow a similar structure or function.
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,44 @@
|
||||
# Relations
|
||||
A relation is similar to a [label](Labels.md), but instead of having a text value it refers to another note.
|
||||
|
||||
## Common use cases
|
||||
|
||||
* **Metadata Relationships for personal use**: For example, linking a book note to an author note.
|
||||
This can be combined with <a class="reference-link" href="Promoted%20Attributes.md">Promoted Attributes</a> to make their display more user-friendly.
|
||||
* **Configuration**: For configuring some notes such as <a class="reference-link" href="../../Note%20Types/Render%20Note.md">Render Note</a>, or configuring <a class="reference-link" href="../Sharing.md">Sharing</a> or <a class="reference-link" href="../Templates.md">Templates</a> (see the list below).
|
||||
* **Scripting**: Attaching scripts to events or conditions related to the note.
|
||||
|
||||
## Creating a relation using the visual editor
|
||||
|
||||
1. Go to the _Owned Attributes_ section in the <a class="reference-link" href="../../Basic%20Concepts%20and%20Features/UI%20Elements/Ribbon.md">Ribbon</a>.
|
||||
2. Press the + button (_Add new attribute_) to the right.
|
||||
3. Select _Add new relation_ for the relation.
|
||||
|
||||
> [!TIP]
|
||||
> If you prefer keyboard shortcuts, press <kbd>Alt</kbd>+<kbd>L</kbd> while focused on a note or in the _Owned Attributes_ section to display the visual editor.
|
||||
|
||||
While in the visual editor:
|
||||
|
||||
* Set the desired name
|
||||
* Set the Target note (the note to point to). Unlike labels, relations cannot exist with a target note.
|
||||
* Check _Inheritable_ if the label should be inherited by the child notes as well. See <a class="reference-link" href="Attribute%20Inheritance.md">Attribute Inheritance</a> for more information.
|
||||
|
||||
## Creating a relation manually
|
||||
|
||||
In the _Owned Attributes_ section in the <a class="reference-link" href="../../Basic%20Concepts%20and%20Features/UI%20Elements/Ribbon.md">Ribbon</a>:
|
||||
|
||||
* To create a relation called `myRelation`:
|
||||
* First type `~myRelation=@` .
|
||||
* After this, an autocompletion box should appear.
|
||||
* Type the title of the note to point to and press <kbd>Enter</kbd> to confirm (or click the desired note).
|
||||
* Alternatively copy a note from the <a class="reference-link" href="../../Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree.md">Note Tree</a> and paste it after the `=` sign (without the `@` , in this case).
|
||||
* To create an inheritable relation, follow the same steps as previously described but instead of `~myRelation` write `~myRelation(inheritable)`.
|
||||
|
||||
## Predefined relations
|
||||
|
||||
These relations are supported and used internally by Trilium.
|
||||
|
||||
> [!TIP]
|
||||
> Some relations presented here end with a `*`. That means that there are multiple relations with the same prefix, consult the specific page linked in the description of that relation for more information.
|
||||
|
||||
<figure class="table" style="width:100%;"><table class="ck-table-resized"><colgroup><col style="width:33.95%;"><col style="width:66.05%;"></colgroup><thead><tr><th>Label</th><th>Description</th></tr></thead><tbody><tr><td><code>runOn*</code></td><td>See <a class="reference-link" href="../../Scripting/Events.md">Events</a></td></tr><tr><td><code>template</code></td><td>note's attributes will be inherited even without a parent-child relationship, note's content and subtree will be added to instance notes if empty. See documentation for details.</td></tr><tr><td><code>inherit</code></td><td>note's attributes will be inherited even without a parent-child relationship. See <a class="reference-link" href="../Templates.md">Templates</a> for a similar concept. See <a class="reference-link" href="Attribute%20Inheritance.md">Attribute Inheritance</a> in the documentation.</td></tr><tr><td><code>renderNote</code></td><td>notes of type <a class="reference-link" href="../../Note%20Types/Render%20Note.md">Render Note</a> will be rendered using a code note (HTML or script) and it is necessary to point using this relation to which note should be rendered</td></tr><tr><td><code>widget_relation</code></td><td>target of this relation will be executed and rendered as a widget in the sidebar</td></tr><tr><td><code>shareCss</code></td><td>CSS note which will be injected into the share page. CSS note must be in the shared sub-tree as well. Consider using <code>share_hidden_from_tree</code> and <code>share_omit_default_css</code> as well.</td></tr><tr><td><code>shareJs</code></td><td>JavaScript note which will be injected into the share page. JS note must be in the shared sub-tree as well. Consider using <code>share_hidden_from_tree</code>.</td></tr><tr><td><code>shareTemplate</code></td><td>Embedded JavaScript note that will be used as the template for displaying the shared note. Falls back to the default template. Consider using <code>share_hidden_from_tree</code>.</td></tr><tr><td><code>shareFavicon</code></td><td>Favicon note to be set in the shared page. Typically you want to set it to share root and make it inheritable. Favicon note must be in the shared sub-tree as well. Consider using <code>share_hidden_from_tree</code>.</td></tr></tbody></table></figure>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 32 KiB |
87
docs/User Guide/User Guide/Advanced Usage/Bulk Actions.md
Normal file
87
docs/User Guide/User Guide/Advanced Usage/Bulk Actions.md
Normal file
@@ -0,0 +1,87 @@
|
||||
# Bulk Actions
|
||||
<figure class="image"><img style="aspect-ratio:1425/654;" src="Bulk Actions_image.png" width="1425" height="654"></figure>
|
||||
|
||||
The _Bulk Actions_ dialog makes it easy to apply changes to multiple notes at once, ranging from simple actions such as adding or removing a label to being executing custom scripts.
|
||||
|
||||
## Interaction
|
||||
|
||||
* The first step is to select the notes in the <a class="reference-link" href="../Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree.md">Note Tree</a>. It's possible to apply bulk actions to:
|
||||
* A single note (and potentially its child notes) simply by clicking on it (with a left click or a right click).
|
||||
* Multiple notes. See <a class="reference-link" href="../Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree/Multiple%20selection.md">Multiple selection</a> on how to do so.
|
||||
* Right click in the <a class="reference-link" href="../Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree.md">Note Tree</a> and select _Advanced_ → _Apply bulk actions_.
|
||||
* By default, only the selected notes will be affected. To also include all the descendants of the notes, check _Include descendants of the selected notes_. The number of affected notes at the top of the dialog will update to reflect the change.
|
||||
* Click on which action to apply from the _Available actions_ section. A detailed description of each is available in the next section.
|
||||
* For each action selected, the _Chosen actions_ section will update to reveal the entry. Each action will have its own configuration.
|
||||
* To remove an action, simply press the X button to the right of it.
|
||||
* It is possible to apply multiple actions of the same type, such as adding multiple types.
|
||||
* When all the actions are defined, press _Execute bulk actions_ to trigger all of them at once.
|
||||
* For convenience, the last bulk action configuration is saved for further use and will be restored when entering the dialog again.
|
||||
|
||||
## Actions
|
||||
|
||||
### Labels
|
||||
|
||||
These actions operate the <a class="reference-link" href="Attributes/Labels.md">Labels</a> of a note:
|
||||
|
||||
* **Add label**
|
||||
* For each note, if it doesn't already have a [label](Attributes/Labels.md) of the given name, it will create it. Keep the _New value_ field empty to create a label without a value, or complete it to assign a value.
|
||||
* If a note already has this label, its value will be updated.
|
||||
* **Update label value**
|
||||
* For each note, if it has a [label](Attributes/Labels.md) of the given name, it will change its value to the specified one. Leave _New value_ field empty to create a label without a value.
|
||||
* Notes without the label will not be affected.
|
||||
* _**Rename label**_
|
||||
* For each note, if it has a [label](Attributes/Labels.md) of the given name, it will be renamed/replaced with a label of the new name. The value of the label (if present) will be kept intact.
|
||||
* Notes without the label will not be affected.
|
||||
* **Delete label**
|
||||
* For each note, if it has a label of a given name, it will be deleted (regardless of whether it has a value or not).
|
||||
* Notes without the label will not be affected.
|
||||
|
||||
### Relations
|
||||
|
||||
These actions operate the <a class="reference-link" href="Attributes/Relations.md">Relations</a> of a note:
|
||||
|
||||
* **Add relation**
|
||||
* For each note, it will create a relation pointing to the given note.
|
||||
* Notes without this relation will not be affected.
|
||||
* **Update relation target**
|
||||
* For each note, it will modify a relation to point to the newly given note.
|
||||
* Notes without this relation will not be affected.
|
||||
* **Rename relation**
|
||||
* For each note, if it has a relation of the given name, it will be renamed/replaced with a relation of the new name. The target note of the relation will be kept intact.
|
||||
* Notes without this relation will not be affected.
|
||||
* **Delete relation**
|
||||
* For each note, if it has a relation of the given name, it will be deleted.
|
||||
* Notes without this relation will not be affected.
|
||||
|
||||
### Notes
|
||||
|
||||
* **Rename note**
|
||||
* For each note, it will change the title of the note to the given one.
|
||||
* As a more advanced use case, the note can be a “template string” which allows for dynamic values with access to the note information via <a class="reference-link" href="../Scripting/Script%20API/Frontend%20API/FNote.md">FNote</a>, for example:
|
||||
* `NEW: ${note.title}` will prefix all notes with `NEW:` .
|
||||
* `${note.dateCreatedObj.format('MM-DD:')}: ${note.title}` will prefix the note titles with each note's creation date (in month-day format).
|
||||
* **Move note**
|
||||
* For each note, it will be moved to the specified parent note.
|
||||
* As an alternative for less complex situations, the notes can be moved directly from within the <a class="reference-link" href="../Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree.md">Note Tree</a> via cut → paste or via the contextual menu.
|
||||
* **Delete note**
|
||||
* For each note, it will be deleted.
|
||||
* As an alternative for less complex situations, the notes can be removed directly from within the <a class="reference-link" href="../Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree.md">Note Tree</a> by selecting them and pressing <kbd>Delete</kbd>.
|
||||
* **Delete note revisions**
|
||||
* This will delete all the <a class="reference-link" href="../Basic%20Concepts%20and%20Features/Notes/Note%20Revisions.md">Note Revisions</a> of the notes.
|
||||
|
||||
### Others
|
||||
|
||||
* **Execute script**
|
||||
* For more complex scenarios, it is possible to type in a JavaScript expression in order to apply the necessary changes.
|
||||
* Examples:
|
||||
* To apply a suffix (`- suffix` in this example), to the note title:
|
||||
|
||||
```javascript
|
||||
note.title = note.title + " - suffix";
|
||||
```
|
||||
|
||||
* To alter attributes of a note based on another attribute, such as setting the `#shareAlias` label to the title of the note:
|
||||
|
||||
```javascript
|
||||
note.setLabel("shareAlias", note.title)
|
||||
```
|
||||
BIN
docs/User Guide/User Guide/Advanced Usage/Bulk Actions_image.png
Normal file
BIN
docs/User Guide/User Guide/Advanced Usage/Bulk Actions_image.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 82 KiB |
@@ -1,16 +0,0 @@
|
||||
# Bulk actions
|
||||
### Execute script
|
||||
|
||||
For more complex scenarios, it is possible to type in a JavaScript expression in order to apply the necessary changes.
|
||||
|
||||
To apply a suffix (`- suffix` in this example), to the note title:
|
||||
|
||||
```javascript
|
||||
note.title = note.title + " - suffix";
|
||||
```
|
||||
|
||||
To alter attributes of a note in a bulk action, such as setting the `#shareAlias` label to the title of the note:
|
||||
|
||||
```javascript
|
||||
note.setLabel("shareAlias", note.title)
|
||||
```
|
||||
@@ -0,0 +1,19 @@
|
||||
# Trilium instance
|
||||
A Trilium instance represents a server. If <a class="reference-link" href="../../Installation%20%26%20Setup/Synchronization.md">Synchronization</a> is set up, since multiple servers are involved (the one from the desktop client and the one the synchronisation is set up with), sometimes it can be useful to distinguish the instance you are running on.
|
||||
|
||||
## Setting the instance name
|
||||
|
||||
To set up a name for the instance, modify the `config.ini`:
|
||||
|
||||
```
|
||||
[General]
|
||||
instanceName=Hello
|
||||
```
|
||||
|
||||
## Distinguishing the instance on back-end
|
||||
|
||||
Use `api.getInstanceName()` to obtain the instance name of the current server, as specified in the config file or in environment variables.
|
||||
|
||||
## Limiting script runs based on instance
|
||||
|
||||
For a script that is run periodically or on a certain event, it's possible to limit it to certain instances without having to change the code. Just add `runOnInstance` and set as the value the instance name where the script should run. To run on multiple named instances, simply add the label multiple times.
|
||||
@@ -53,7 +53,7 @@ Trilium will then find our code note created above and execute it. `api.req`, `a
|
||||
|
||||
In the code note we check the request method and then use trivial authentication - keep in mind that these endpoints are by default totally unauthenticated, and you need to take care of this yourself.
|
||||
|
||||
Once we pass these checks we will just create the desired note using [Script API](../Note%20Types/Code/Script%20API.md).
|
||||
Once we pass these checks we will just create the desired note using [Script API](../Scripting/Script%20API.md).
|
||||
|
||||
## Custom resource provider
|
||||
|
||||
|
||||
@@ -17,14 +17,16 @@ And all children of "2022 Books" will be created with initial title "\[Author na
|
||||
|
||||
The value of `#titleTemplate` is evaluated at the point of note's creation as a JavaScript string, which means it can be enriched with the help of JS string interpolation with dynamic data.
|
||||
|
||||
As an example, imagine you collect server outage incidents and write some notes. It looks like this:
|
||||
Second variable injected is `parentNote` which gives access to the parent [`FNote`](../Scripting/Script%20API/Frontend%20API/FNote.md).
|
||||
|
||||
* Incidents
|
||||
* 2022-05-09: System crash
|
||||
* 2022-05-15: Backup delay
|
||||
See also <a class="reference-link" href="Templates.md">Templates</a> which provides similar capabilities, including default note's content.
|
||||
|
||||
You can automatize the date assignment by assigning a label `#titleTemplate="${now.format('YYYY-MM-DD')}: "` to the parent note "Incidents". Whenever a new child note is created, the title template is evaluated with the injected [now](https://day.js.org/docs/en/display/format) object.
|
||||
### Examples
|
||||
|
||||
Second variable injected is [parentNote](https://triliumnext.github.io/Notes/backend_api/BNote.html), an example could be `#titleTemplate="${parentNote.getLabelValue('authorName')}'s literary works"`.
|
||||
|
||||
See also \[\[[template](Templates.md)\]\] which provides similar capabilities, including default note's content.
|
||||
* Imagine you collect server outage incidents and write some notes. It looks like this:
|
||||
* Incidents
|
||||
* 2022-05-09: System crash
|
||||
* 2022-05-15: Backup delay
|
||||
* You can automatize the date assignment by assigning a label `#titleTemplate="${now.format('YYYY-MM-DD')}: "` to the parent note "Incidents". Whenever a new child note is created, the title template is evaluated with the injected [now](https://day.js.org/docs/en/display/format) object.
|
||||
* To use a parent's attribute in the title of new notes: `#titleTemplate="${parentNote.getLabelValue('authorName')}'s literary works"`
|
||||
* To mirror the parent's note title: `${parentNote.title}`
|
||||
18
docs/User Guide/User Guide/Advanced Usage/Hidden Notes.md
Normal file
18
docs/User Guide/User Guide/Advanced Usage/Hidden Notes.md
Normal file
File diff suppressed because one or more lines are too long
BIN
docs/User Guide/User Guide/Advanced Usage/Hidden Notes_image.png
Normal file
BIN
docs/User Guide/User Guide/Advanced Usage/Hidden Notes_image.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
@@ -3,7 +3,7 @@ Trilium allows you to share selected notes as **publicly accessible** read-only
|
||||
|
||||
## Prerequisites
|
||||
|
||||
To use the sharing feature, you must have a [server installation](../Installation%20%26%20Setup/Server%20Installation.md) of Trilium. This is necessary because the notes will be hosted from the server.
|
||||
To use the sharing feature, you must have a <a class="reference-link" href="../Installation%20%26%20Setup/Server%20Installation.md">Server Installation</a> of Trilium. This is necessary because the notes will be hosted from the server.
|
||||
|
||||
## How to Share a Note
|
||||
|
||||
@@ -40,7 +40,7 @@ To protect shared notes with a username and password, you can use the `#shareCre
|
||||
|
||||
The default shared page is basic in design, but you can customize it using your own CSS:
|
||||
|
||||
* **Custom CSS**: Link a CSS [code note](../Note%20Types/Code.md) to the shared page by adding a `~shareCss` relation to the note. If you want this style to apply to the entire subtree, make the label inheritable. You can hide the CSS code note from the tree navigation by adding the `#shareHiddenFromTree` label.
|
||||
* **Custom CSS**: Link a CSS <a class="reference-link" href="../Note%20Types/Code.md">Code</a> note to the shared page by adding a `~shareCss` relation to the note. If you want this style to apply to the entire subtree, make the label inheritable. You can hide the CSS code note from the tree navigation by adding the `#shareHiddenFromTree` label.
|
||||
* **Omitting Default CSS**: For extensive styling changes, use the `#shareOmitDefaultCss` label to avoid conflicts with Trilium's [default stylesheet](../Basic%20Concepts%20and%20Features/Themes.md).
|
||||
|
||||
### Adding JavaScript
|
||||
@@ -81,12 +81,6 @@ To customize the favicon for your shared pages, create a relation `~shareFavicon
|
||||
|
||||
You can designate a specific note or folder as the root of your shared content by adding the `#shareRoot` label. This note will be linked when visiting `[http://domain.tld/share](http://domain/share)`, making it easier to use Trilium as a fully-fledged website. Consider combining this with the `#shareIndex` label, which will display a list of all shared notes.
|
||||
|
||||
## Additional Options
|
||||
|
||||
* **Raw Note Sharing**: Use the `#shareRaw` label to share a note without any HTML wrapper.
|
||||
* **Disallow Robot Indexing**: Add the `#shareDisallowRobotIndexing` label to prevent search engines from indexing the shared page by including a `noindex, follow` meta tag and `X-Robots-Tag: noindex` header.
|
||||
* **Shared Notes Index**: For text notes with the `#shareIndex` label, the content will display a list of all shared note roots.
|
||||
|
||||
## Limitations
|
||||
|
||||
While the sharing feature is powerful, it has some limitations:
|
||||
@@ -98,4 +92,8 @@ While the sharing feature is powerful, it has some limitations:
|
||||
* **Protected Notes**: Cannot be shared.
|
||||
* **Include Notes**: Not supported.
|
||||
|
||||
Some of these limitations may be addressed in future updates.
|
||||
Some of these limitations may be addressed in future updates.
|
||||
|
||||
## Attribute reference
|
||||
|
||||
<figure class="table"><table><thead><tr><th>Attribute</th><th>Description</th></tr></thead><tbody><tr><td><code>shareHiddenFromTree</code></td><td>this note is hidden from left navigation tree, but still accessible with its URL</td></tr><tr><td><code>shareExternalLink</code></td><td>note will act as a link to an external website in the share tree</td></tr><tr><td><code>shareAlias</code></td><td>define an alias using which the note will be available under <code>https://your_trilium_host/share/[your_alias]</code></td></tr><tr><td><code>shareOmitDefaultCss</code></td><td>default share page CSS will be omitted. Use when you make extensive styling changes.</td></tr><tr><td><code>shareRoot</code></td><td>marks note which is served on /share root.</td></tr><tr><td><code>shareDescription</code></td><td>define text to be added to the HTML meta tag for description</td></tr><tr><td><code>shareRaw</code></td><td>Note will be served in its raw format, without HTML wrapper. See also <a class="reference-link" href="Sharing/Serving%20directly%20the%20content%20o.md">Serving directly the content of a note</a> for an alternative method without setting an attribute.</td></tr><tr><td><code>shareDisallowRobotIndexing</code></td><td><p>Indicates to web crawlers that the page should not be indexed of this note by:</p><ul><li>Setting the <code>X-Robots-Tag: noindex</code> HTTP header.</li><li>Setting the <code>noindex, follow</code> meta tag.</li></ul></td></tr><tr><td><code>shareCredentials</code></td><td>require credentials to access this shared note. Value is expected to be in format <code>username:password</code>. Don't forget to make this inheritable to apply to child-notes/images.</td></tr><tr><td><code>shareIndex</code></td><td>Note with this label will list all roots of shared notes.</td></tr></tbody></table></figure>
|
||||
@@ -23,7 +23,7 @@ To create an instance note through the UI:
|
||||
|
||||

|
||||
|
||||
For the template to appear in the menu, the template note must have the `#template` label. Do not confuse this with the `~template` relation, which links the instance note to the template note. If you use [workspaces](../Basic%20Concepts%20and%20Features/Navigation/Workspace.md), you can also mark templates with `#workspaceTemplate` to display them only in the workspace.
|
||||
For the template to appear in the menu, the template note must have the `#template` label. Do not confuse this with the `~template` relation, which links the instance note to the template note. If you use [workspaces](../Basic%20Concepts%20and%20Features/Navigation/Workspaces.md), you can also mark templates with `#workspaceTemplate` to display them only in the workspace.
|
||||
|
||||
Templates can also be added or changed after note creation by creating a `~template` relation pointing to the desired template note.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user