Files
Trilium/docs/User Guide/User Guide/Advanced Usage/Attributes/Labels.md

42 lines
13 KiB
Markdown
Raw Normal View History

# Labels
A label is an [attribute](../Attributes.md) of a note which has a name and optionally a value. 
## Common use cases
* **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 (see reference below).
* **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>.
## Creating a label 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 label_ for the relation.
2025-04-07 09:47:15 +03:00
> [!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
* Optionally, set the value of the label. Labels can exist without a value.
* 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.
2025-04-07 09:47:15 +03:00
## Creating a label manually
2025-04-07 09:47:15 +03:00
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 label called `myLabel` with no value, simply type `#myLabel`.
* To create a label called `myLabel` with a value `value`, simply type `#myLabel=value`.
* If the value contains spaces, then the text must be quoted: `#myLabel="Hello world"`.
* If the string contains quotes (regardless of whether it has spaces), then the text must be quoted with apostrophes instead: `#myLabel='Hello "world"'`.
* To create an inheritable label called `myLabel`, simply write `#myLabel(inheritable)` for no value or `#myLabel(inheritable)=value` if there is a value.
## Predefined labels
This is a list of labels that Trilium natively supports.
2025-04-07 09:47:15 +03:00
> [!TIP]
> Some labels presented here end with a `*`. That means that there are multiple labels with the same prefix, consult the specific page linked in the description of that label for more information.
2025-04-07 09:47:15 +03:00
<figure class="table" style="width:100%;"><table class="ck-table-resized"><colgroup><col style="width:33.82%;"><col style="width:66.18%;"></colgroup><thead><tr><th>Label</th><th>Description</th></tr></thead><tbody><tr><td><code>disableVersioning</code></td><td>Disables automatic creation of&nbsp;<a class="reference-link" href="../../Basic%20Concepts%20and%20Features/Notes/Note%20Revisions.md">Note Revisions</a>&nbsp;for a particular note. Useful for e.g. large, but unimportant notes - e.g. large JS libraries used for scripting.</td></tr><tr><td><code>versioningLimit</code></td><td>Limits the maximum number of&nbsp;<a class="reference-link" href="../../Basic%20Concepts%20and%20Features/Notes/Note%20Revisions.md">Note Revisions</a>&nbsp;for a particular note, overriding the global settings.</td></tr><tr><td><code>calendarRoot</code></td><td>Marks the note which should be used as root for&nbsp;<a class="reference-link" href="../Advanced%20Showcases/Day%20Notes.md">Day Notes</a>. Only one should be marked as such.</td></tr><tr><td><code>archived</code></td><td>Hides notes from default search results and dialogs. Archived notes can optionally be hidden in the&nbsp;<a class="reference-link" href="../../Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree.md">Note Tree</a>.</td></tr><tr><td><code>excludeFromExport</code></td><td>Excludes this note and its children when exporting.</td></tr><tr><td><code>run</code>, <code>runOnInstance</code>, <code>runAtHour</code></td><td>See&nbsp;<a class="reference-link" href="../../Scripting/Events.md">Events</a>.</td></tr><tr><td><code>disableInclusion</code></td><td>Scripts with this label won't be included into parent script execution.</td></tr><tr><td><code>sorted</code></td><td><p>Keeps child notes sorted by title alphabetically.</p><p>When given a value, it will sort by the value of another label instead. If one of the child notes doesn't have the specified label, the title will be used for them instead.</p></td></tr><tr><td><code>sortDirection</code></td><td><p>If <code>sorted</code> is applied, specifies the direction of the sort:</p><ul><li><code>ASC</code>, ascending (default)</li><li><code>DESC</code>, descending</li></ul></td></tr><tr><td><code>sortFoldersFirst</code></td><td>If <code>sorted</code> is applied, folders (notes with children) will be sorted as a group at the top, and the rest will be sorted.</td></tr><tr><td><code>top</code></td><td>If <code>sorted</code> is applied to the parent note, keeps given note on top in its parent.</td></tr><tr><td><code>hidePromotedAttributes</code></td><td>Hide&nbsp;<a class="reference-link" href="Promoted%20Attributes.md">Promoted Attributes</a>&nbsp;on this note. Generally useful when defining inherited attributes, but the parent note doesn't need them.</td></tr><tr><td><code>readOnly</code></td><td>Marks a note to be always be <a href="../../Basic%20Concepts%20and%20Features/Notes/Read-Only%20Notes.md">read-only</a>, if it's a supported note (text, code, mermaid).</td></tr><tr><td><code>autoReadOnlyDisabled</code></td><td>Disables automatic <a href="../../Basic%20Concepts%20and%20Features/Notes/Read-Only%20Notes.md">read-only mode</a> for the given note.</td></tr><tr><td><code>appCss</code></td><td>Marks CSS notes which are loaded into the Trilium application and can thus be used to modify Trilium's looks. See&nbsp;<a class="reference-link" href="../../Theme%20development/Custom%20app-wide%20CSS.md">Custom app-wide CSS</a>&nbsp;for more info.</td></tr><tr><td><code>appTheme</code></td><td>Marks CSS notes which are full Trilium themes and are thus available in Trilium options. See&nbsp;<a class="reference-link" href="../../Theme%20development">Theme development</a>&nbsp;for more information.</td></tr><tr><td><code>appThemeBase</code></td><td>Set to <code>next</code>, <code>next-light</code>, or <code>next-dark</code> to use the corresponding TriliumNext theme (auto, light or dark) as the base for a custom theme, instead of the legacy one. See&nbsp;<a class="reference-link" href="../../Theme%20development/Customize%20the%20Next%2