Skip to content

Build your personal knowledge base with Trilium Notes

feat(templates): default title for notes created from a template (closes #5080)

Elian Doran948a9135144b
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index 33d2688d83..b2a2d9bfac 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -856,7 +856,8 @@
"share_logo": "An image note used as the logo of the shared page. It has to sit inside the shared subtree.",
"share_open_graph_image_relation": "An image note served as the <code>og:image</code> of the shared page. Set the label of the same name instead to point at an address.",
"share_html": "An HTML note injected into the shared page, where <code>#shareHtmlLocation</code> on that note says. It has to sit inside the shared subtree.",
- "meeting_recording": "Marks a note created by the \"Transcribe meeting\" button in the launch bar, which holds the transcript of a meeting."
+ "meeting_recording": "Marks a note created by the \"Transcribe meeting\" button in the launch bar, which holds the transcript of a meeting.",
+ "template_title_template": "Set on a template note: default title of notes created from the template, used instead of the parent's <code>#titleTemplate</code>. Evaluated like <code>#titleTemplate</code>, with the injected <code>now</code> and <code>parentNote</code> variables, e.g. <code>Meeting ${now.format('YYYY-MM-DD')}</code>."
},
"attribute_editor": {
"help_text_body1": "To add label, just type e.g. <code>#rock</code> or if you want to add also value then e.g. <code>#year = 2020</code>",
diff --git a/apps/client/src/widgets/attribute_widgets/attr_help.ts b/apps/client/src/widgets/attribute_widgets/attr_help.ts
index 193ffdce8f..21e6d65c2d 100644
--- a/apps/client/src/widgets/attribute_widgets/attr_help.ts
+++ b/apps/client/src/widgets/attribute_widgets/attr_help.ts
@@ -59,6 +59,7 @@ export const ATTR_HELP: AttrHelpMap = {
displayRelations: t("attribute_detail.display_relations"),
hideRelations: t("attribute_detail.hide_relations"),
titleTemplate: t("attribute_detail.title_template"),
+ "template:titleTemplate": t("attribute_detail.template_title_template"),
template: t("attribute_detail.template"),
color: t("attribute_detail.color"),
keyboardShortcut: t("attribute_detail.keyboard_shortcut"),
diff --git a/apps/server/src/assets/help/help_content.json b/apps/server/src/assets/help/help_content.json
index d22fa3f9e5..961bdd0b51 100644
--- a/apps/server/src/assets/help/help_content.json
+++ b/apps/server/src/assets/help/help_content.json
@@ -198,11 +198,11 @@
"_help_AlhDUqhENtH7": "<p>It is possible to provide a CSS file to be used regardless of the theme set by the user.</p><p>The quickest way to create one is <em>Insert child note</em> → <em>Code</em> → <em>Custom CSS</em> in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_YtSN43OrfzaA\">Note tree contextual menu</a>.</p><p>Alternatively, create a&nbsp;<a class=\"reference-link\" href=\"#root/_help_6f9hih2hXXZk\">Code</a>&nbsp;note manually, set the language to CSS and apply the <code>#appCss</code> label.</p><h2>Seeing the changes</h2><p>Adding a new <em>app CSS note</em> or modifying an existing one does not immediately apply changes. To see the changes, press Ctrl+Shift+R to refresh the page first.</p><h2>Sample use cases</h2><h3>Customizing the printing stylesheet</h3><aside class=\"admonition tip\"><p>Since v0.99.2, it's no longer possible to use <code>#appCss</code> to customize the printing CSS, since the printing is now done in an isolated environment.</p><p>However, it's still possible to customize the CSS via <code>~printCss</code>; see&nbsp;<a class=\"reference-link\" href=\"#root/_help_NRnIZmSMc5sj\">Printing &amp; Exporting as PDF</a>&nbsp;for more information.</p></aside><h3>Per-workspace styles</h3><p>When using&nbsp;<a class=\"reference-link\" href=\"#root/_help_9sRHySam5fXb\">Workspaces</a>, it can be helpful to create a visual distinction between notes in different workspaces.</p><p>To do so:</p><ol><li>In the note with <code>#workspace</code>, add an inheritable attribute <code>#cssClass(inheritable)</code> with a value that uniquely identifies the workspace (say <code>my-workspace</code>).</li><li>Anywhere in the note structure, create a CSS note with <code>#appCss</code>.</li></ol><h4>Change the color of the icons in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a></h4><pre><code class=\"language-text-x-trilium-auto\">.fancytree-node.my-workspace.fancytree-custom-icon {\n color: #ff0000;\n}</code></pre><h4>Change the color of the note title and the icon</h4><p>To change the color of the note title and the icon (above the content):</p><pre><code class=\"language-text-x-trilium-auto\">.note-split.my-workspace .note-icon-widget button.note-icon,\n.note-split.my-workspace .note-title-widget input.note-title {\n color: #ff0000;\n}</code></pre><h4>Add a watermark to the note content</h4><figure class=\"image image-style-align-right image_resized\" style=\"width:39.97%;\"><img style=\"aspect-ratio:641/630;\" src=\"{{helpAssets}}/User%20Guide/Theme%20development/Custom%20app-wide%20CSS_image.png\" width=\"641\" height=\"630\"></figure><ol><li>Insert an image in any note and take the URL of the image.</li><li>Use the following CSS, adjusting the <code>background-image</code> and <code>width</code> and <code>height</code> to the desired values.</li></ol><pre><code class=\"language-text-x-trilium-auto\">.note-split.my-workspace .scrolling-container:after {\n position: fixed;\n content: \"\";\n background-image: url(\"/api/attachments/Rvm3zJNITQI1/image/logo.png\");\n background-size: contain;\n background-position: center;\n background-repeat: no-repeat;\n width: 237px;\n height: 44px;\n bottom: 1em;\n right: 1em;\n opacity: 0.5;\n z-index: 0;\n}</code></pre><h2>Limitations</h2><p>Some parts of the application can't be styled directly via custom CSS because they are rendered in an isolated mode (shadow DOM), more specifically:</p><ul><li>The slides in a&nbsp;<a class=\"reference-link\" href=\"#root/_help_zP3PMqaG71Ct\">Presentation</a>.</li></ul>",
"_help_g1mlRoU8CsqC": "<aside class=\"admonition note\"><p>This page explains, step‑by‑step, how to create a custom icon pack. For a general description of how to use already existing icon packs, see&nbsp;<a class=\"reference-link\" href=\"#root/_help_gOKqSJgXLcIj\">Icon Packs</a>.</p></aside><p>First read the quick flow to get the overall steps. After that there is a concrete example (Phosphor) with a small Node.js script you can run to generate the manifest.</p><h2>Quick flow (what you need to do)</h2><ol><li>Verify the icon set is a font (one of: .woff2, .woff, .ttf).</li><li>Obtain a list that maps icon names to Unicode code points (often provided as a JSON like <code>selection.json</code> or a CSS file).</li><li>Create a manifest JSON that maps icon ids to glyphs and search terms.</li><li>Create a Trilium note of type Code, set language to JSON, paste the manifest as the note content.</li><li>Upload the font file as an attachment to the same note (MIME type must be <code>font/woff2</code>, <code>font/woff</code>, or <code>font/ttf</code> and role <code>file</code>).</li><li>Add the label <code>#iconPack=&lt;prefix&gt;</code> to the note (prefix: letters, digits, hyphen, underscore and non-ASCII characters only).</li><li>Refresh the client and verify the icon pack appears in the icon selector.</li></ol><h2>Verify the icon set</h2><p>The first step is to analyze if the icon set being packed can be integrated into Trilium.</p><p>Trilium only supports <strong>font-based icon sets</strong>, with the following formats:</p><figure class=\"table\"><table><thead><tr><th>Extension</th><th>MIME type</th><th>Description</th></tr></thead><tbody><tr><td><code>.woff2</code></td><td><code>font/woff2</code></td><td>Recommended due to great compression (low size).</td></tr><tr><td><code>.woff</code></td><td><code>font/woff</code></td><td>Higher compatibility, but the font file is bigger.</td></tr><tr><td><code>.ttf</code></td><td><code>font/ttf</code></td><td>Most common, but highest font size.</td></tr></tbody></table></figure><p>Trilium <strong>does not</strong> support the following formats:</p><ul><li>SVG-based fonts.</li><li>Individual SVGs.</li><li><code>.eot</code> fonts (legacy and proprietary).</li><li>Duotone icons, since it requires a special CSS format that Trilium doesn't support.</li><li>Any other font format not specified in the <em>Supported formats</em> section.</li></ul><p>In this case, the font must be manually converted to one of the supported formats (ideally <code>.woff2</code>).</p><h2>Manifest format</h2><p>The manifest is a JSON object with an <code>icons</code> map. Each entry key is the CSS/class id you will use (Trilium uses the CSS class when rendering). Value object:</p><ul><li>glyph: the single character (the glyph) — can be the escaped Unicode (e.g. \"\\ue9c2\") or the literal character.</li><li>terms: array of search aliases; the first term is used as display name in the selector.</li></ul><p>Example minimal manifest:</p><pre><code class=\"language-text-x-trilium-auto\">{\n \"icons\": {\n \"ph-acorn\": {\n \"glyph\": \"\\uea3f\",\n \"terms\": [\"acorn\", \"nut\"]\n },\n \"ph-book\": {\n \"glyph\": \"\\uea40\",\n \"terms\": [\"book\", \"read\"]\n }\n }\n}</code></pre><aside class=\"admonition note\"><ul><li>You can supply glyph as the escaped <code>\\uXXXX</code> sequence or as the actual UTF‑8 character. The CSS form (<code>\\ea3f</code>, as written in a stylesheet's <code>content</code>) is accepted too, so glyphs copied out of the font's own CSS work as they stand.</li><li>It is also possible to use the unescaped glyph inside the JSON. It will appear strange (e.g. ), but it will be rendered properly regardless.</li><li>The manifest keys (e.g. <code>ph-acorn</code>) should match the class names used by the font (prefix + name is a common pattern).</li><li>Like the prefix, a manifest key becomes a CSS class name, so it can contain only letters, digits, hyphens, underscores and non-ASCII characters. Punctuation and whitespace (e.g. <code>ph.acorn</code> or <code>ph acorn</code>) are not usable as class names; icons with such a key are skipped and an error is logged in&nbsp;<a class=\"reference-link\" href=\"#root/_help_bnyigUA2UK7s\">Backend (server) logs</a>, while the rest of the pack still loads.</li></ul></aside><h2>Concrete example: Phosphor Icons</h2><p><a href=\"https://phosphoricons.com/\">Phosphor Icons</a> provide a <code>selection.json</code> that includes <code>properties.code</code> (the codepoint) and <code>properties.name</code> (the icon name). The goal: convert that into Trilium's manifest.</p><p>Sample <code>selection.json</code> excerpt:</p><pre><code class=\"language-text-x-trilium-auto\">{\n \"icons\": [\n {\n \"icon\": {\n \"paths\": [ /* [...] */ ],\n \"grid\": 0,\n \"attrs\": [{}],\n \"isMulticolor\": false,\n \"isMulticolor2\": false,\n \"tags\": [\"acorn\"]\n },\n \"attrs\": [{}],\n \"properties\": {\n \"id\": 0,\n \"order\": 1513,\n \"name\": \"acorn\",\n \"code\": 60314,\n \"ligatures\": \"acorn\",\n \"prevSize\": 16\n },\n \"setIdx\": 0,\n \"setId\": 0,\n \"iconIdx\": 0\n },\n /* [...] */\n ]\n}</code></pre><details class=\"trilium-collapsible\" open=\"\"><summary>A tiny Node.js script to produce the manifest</summary><p>Place <code>selection.json</code> in the same directory and run with Node 20+):</p><pre><code class=\"language-text-javascript\">import { join } from \"node:path\";\nimport { readFileSync, writeFileSync } from \"node:fs\";\n\nfunction processIconPack(packName) {\n const path = join(packName);\n const selectionMeta = JSON.parse(readFileSync(join(path, \"selection.json\"), \"utf-8\"));\n const icons = {};\n\n for (const icon of selectionMeta.icons) {\n let name = icon.properties.name;\n if (name.endsWith(`-${packName}`)) {\n name = name.split(\"-\").slice(0, -1).join(\"-\");\n }\n\n const id = `ph-${name}`;\n icons[id] = {\n glyph: `${String.fromCharCode(icon.properties.code)}`,\n terms: [ name ]\n };\n }\n\n writeFileSync(\"manifest.json\", JSON.stringify(icons, null, 2), \"utf8\");\n console.log(\"manifest.json created\");\n}\n\nprocessIconPack(\"light\");</code></pre><p>What to do with the script:</p><ul><li>Put <code>selection.json</code> and <code>build-manifest.js</code> in a folder.</li><li>Run: node build-manifest.js</li><li>The script writes <code>manifest.json</code> — open it, verify contents, then copy into a Trilium Code note (language: JSON).</li></ul></details><aside class=\"admonition tip\"><p><strong>Mind the escape format when processing CSS</strong></p><p>The Unicode escape syntax is different in CSS (<code>\"\\ea3f\"</code>) when compared to JSON (<code>\"\\uea3f\"</code>). Notice how the JSON escape is <code>\\u</code> and not <code>\\</code>. Both forms are accepted: keep the CSS escape by writing the backslash itself as <code>\"\\\\ea3f\"</code> in the JSON, or convert it to the JSON escape <code>\"\\uea3f\"</code>.</p><p>As a more compact alternative, provide the un-escaped character directly, as UTF-8 is supported.</p></aside><h3>Assigning the prefix</h3><p>Before an icon pack can be used, it needs to have a prefix defined. This prefix uniquely identifies the icon pack so that it can be used throughout the application.</p><p>To do so, Trilium makes use of the same format that was used for the internal icon pack (Boxicons). For example, when an icon from Boxicons is set, it looks like this: <code>#iconClass=\"bx bxs-sushi\"</code>. In this case, the icon pack prefix is <code>bx</code> and the icon class name is <code>bxs-sushi</code>.</p><p>In order for an icon pack to be recognized, the prefix must be specified in the <code>#iconPack</code> label.&nbsp;</p><p>For our example with Phosphor Icons, we can use the <code>ph</code> prefix since it also matches the prefix set in the original CSS. So in this case it would be <code>#iconPack=ph</code>.</p><aside class=\"admonition important\"><p>The prefix must consist of only letters, digits, hyphens, underscores and non-ASCII characters. If the prefix doesn't match these constraints, the icon pack will be ignored and an error will be logged in&nbsp;<a class=\"reference-link\" href=\"#root/_help_bnyigUA2UK7s\">Backend (server) logs</a>.</p></aside><h2>Creating the Trilium icon pack note</h2><ol><li>Create a note of type <em>Code</em>.</li><li>Set the language to <em>JSON</em>.</li><li>Rename the note. The name of the note will also be the name of the icon pack as displayed in the list of icons.</li><li>Copy and paste the manifest generated in the previous step as the content of this note.</li><li>Go to the <a href=\"#root/_help_0vhv7lsOLy82\">note attachment</a> and upload the font file (in <code>.woff2</code>, <code>.woff</code>, <code>.ttf</code>) format.<ol><li>Trilium identifies the font to use from attachments via the MIME type, make sure the MIME type is displayed correctly after uploading the attachment (for example <code>font/woff2</code>).</li><li>Make sure the <code>role</code> appears as <code>file</code>, otherwise the font will not be identified.</li><li>Multiple attachments are supported, but only one font will actually be used in Trilium's order of preference: <code>.woff2</code>, <code>.woff</code>, <code>.ttf</code>. As such, there's not much reason to upload more than one font per icon pack.</li></ol></li><li>Add label: <code>#iconPack=&lt;prefix&gt;</code> (for Phosphor example: <code>#iconPack=ph</code>).</li></ol><h3>Final steps</h3><ul><li><a href=\"#root/_help_s8alTXmpFR61\">Refresh the client</a><ul><li>Change the icon of the note and look for the <em>Filter</em> icon in the top-right side.</li><li>Check if the new icon pack is displayed there and click on it to see the full list of icons.</li><li>Go through most of the items to look for issues such as missing icon, wrong names (some icons have aliases/terms that can cause issues).</li></ul></li><li>Optionally, assign an icon from the new icon pack to this note. This icon will be used in the icon pack filter for a visual distinction.</li><li>The icon pack can then be <a href=\"#root/_help_mHbBMPDPkVV5\">exported as ZIP</a> in order to be distributed to other users.<ul><li>It's important to note that icon packs are considered “unsafe” by default, so “Safe mode” must be disabled when importing the ZIP.</li><li>Consider linking new users to the&nbsp;<a class=\"reference-link\" href=\"#root/_help_gOKqSJgXLcIj\">Icon Packs</a>&nbsp;documentation in order to understand how to import and use an icon pack.</li></ul></li></ul><h3>Troubleshooting</h3><p>If the icon pack doesn't show up, look through the&nbsp;<a class=\"reference-link\" href=\"#root/_help_bnyigUA2UK7s\">Backend (server) logs</a>&nbsp;for clues.</p><ul><li>One example is if the font could not be retrieved: <code>ERROR: Icon pack is missing WOFF/WOFF2/TTF attachment: Boxicons v3 400 (dup) (XRzqDQ67fHEK)</code>.</li><li>Make sure the prefix is unique and not already taken by some other icon pack. When there are two icon packs with the same prefix, only one is used. The server logs will indicate if this situation occurs.</li><li>Make sure the prefix consists only of letters, digits, hyphens, underscores and non-ASCII characters.</li><li>If the pack loads but individual icons are missing, check the logs for <code>Skipping icon '&lt;key&gt;' of icon pack</code> — that key uses characters outside the allowed set and needs renaming in the manifest.</li></ul>",
"_help_zEY4DaJG4YT5": "<figure class=\"image\"><img style=\"aspect-ratio:1071/146;\" src=\"{{helpAssets}}/User%20Guide/Advanced%20Usage/Attributes_image.png\" width=\"1071\" height=\"146\"></figure><p>In Trilium, attributes are key-value pairs assigned to notes, providing additional metadata or functionality. There are two primary types of attributes:</p><ol><li><p><a class=\"reference-link\" href=\"#root/_help_HI6GBBIduIgv\">Labels</a>&nbsp;can be used for a variety of purposes, such as storing metadata or configuring the behavior of notes. Labels are also searchable, enhancing note retrieval.</p><p>For more information, including predefined labels, see&nbsp;<a class=\"reference-link\" href=\"#root/_help_HI6GBBIduIgv\">Labels</a>.</p></li><li><p><a class=\"reference-link\" href=\"#root/_help_Cq5X6iKQop6R\">Relations</a>&nbsp;define connections between notes, similar to links. These can be used for metadata and scripting purposes.</p><p>For more information, including a list of predefined relations, see&nbsp;<a class=\"reference-link\" href=\"#root/_help_Cq5X6iKQop6R\">Relations</a>.</p></li></ol><p>These attributes play a crucial role in organizing, categorizing, and enhancing the functionality of notes.</p><h2>Types of attributes</h2><p>Conceptually there are two types of attributes (applying to both labels and relations):</p><ol><li><strong>System attributes</strong><br>As the name suggest, these attributes have a special meaning since they are interpreted by Trilium. For example the <code>color</code> attribute will change the color of the note as displayed in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>&nbsp;and links, and <code>iconClass</code> will change the icon of a note.</li><li><strong>User-defined attributes</strong><br>These are free-form labels or relations that can be used by the user. They can be used purely for categorization purposes (especially if combined with&nbsp;<a class=\"reference-link\" href=\"#root/_help_eIg8jdvaoNNd\">Search</a>), or they can be given meaning through the use of&nbsp;<a class=\"reference-link\" href=\"#root/_help_CdNpE2pqjmI6\">Scripting</a>.</li></ol><p>In practice, Trilium makes no direct distinction of whether an attribute is a system one or a user-defined one. A label or relation is considered a system attribute if it matches one of the built-in names (e.g. like the aforementioned <code>iconClass</code>). Keep this in mind when creating &nbsp;<a class=\"reference-link\" href=\"#root/_help_OFXdgB2nNk1F\">Promoted Attributes</a>&nbsp;in order not to accidentally alter a system attribute (unless intended).</p><h2>Viewing the list of attributes</h2><p>Both the labels and relations for the current note are displayed in:</p><ul><li>The&nbsp;<a class=\"reference-link\" href=\"#root/_help_RnaPdbciOfeq\">Right Sidebar</a>, in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_uNtgN0cUKEBc\">Attributes tab</a>&nbsp;with a grid-like view.</li><li>A more advanced option, in&nbsp;<a class=\"reference-link\" href=\"#root/_help_AlJ73vBCjWDw\">Status bar</a>&nbsp;→&nbsp;<span class=\"tn-icon bx bx-list-check\"></span> (<em>Attributes</em>) where the attributes are displayed in a textual way, making it easy to copy them around or make batch modifications.<ul><li>In the list of attributes, labels are prefixed with the <code>#</code> character whereas relations are prefixed with the <code>~</code> character.</li></ul></li></ul><h2>Attribute Definitions and Promoted Attributes</h2><p><a class=\"reference-link\" href=\"#root/_help_OFXdgB2nNk1F\">Promoted Attributes</a>&nbsp;create a form-like editing experience for attributes, which makes it easy to enhancing the organization and management of attributes</p><h2>Multiplicity</h2><p>Attributes in Trilium can be \"multi-valued\", meaning multiple attributes with the same name can co-exist. This can be combined with&nbsp;<a class=\"reference-link\" href=\"#root/_help_OFXdgB2nNk1F\">Promoted Attributes</a>&nbsp;to easily add them.</p><h2>Attribute Inheritance</h2><p>Trilium supports attribute inheritance, allowing child notes to inherit attributes from their parents. For more information, see&nbsp;<a class=\"reference-link\" href=\"#root/_help_bwZpz2ajCEwO\">Attribute Inheritance</a>.</p>",
- "_help_HI6GBBIduIgv": "<p>A label is an <a href=\"#root/_help_zEY4DaJG4YT5\">attribute</a> of a note which has a name and optionally a value.</p><h2>Common use cases</h2><ul><li><strong>Metadata for personal use</strong>: Assign labels with optional values for categorization, such as <code>#year=1999</code>, <code>#genre=\"sci-fi\"</code>, or <code>#author=\"Neal Stephenson\"</code>. This can be combined with&nbsp;<a class=\"reference-link\" href=\"#root/_help_OFXdgB2nNk1F\">Promoted Attributes</a>&nbsp;to make their display more user-friendly.</li><li><strong>Configuration</strong>: Labels can configure advanced features or settings (see reference below).</li><li><strong>Scripts and Plugins</strong>: Used to tag notes with special metadata, such as the \"weight\" attribute in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_R7abl2fc6Mxi\">Weight Tracker</a>.</li></ul><h2>Creating a label using the visual editor</h2><ol><li>Go to the&nbsp;<a class=\"reference-link\" href=\"#root/_help_uNtgN0cUKEBc\">Attributes tab</a>&nbsp;in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_RnaPdbciOfeq\">Right Sidebar</a>.</li><li>Press the&nbsp;<span class=\"tn-icon bx bx-plus\"></span> (Add attribute) button at the end of the list, or via the&nbsp;<span class=\"tn-icon bx bx-plus\"></span> button at the top-right of the section → <em>Add new label</em>.</li></ol><p>While in the visual editor:</p><ul><li>Set the desired name.</li><li>Optionally, set the value of the label. Labels can exist without a value.</li><li>Children can inherit this relation, click the relation and check <em>Inheritable</em>. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_bwZpz2ajCEwO\">Attribute Inheritance</a>&nbsp;for more information.</li></ul><aside class=\"admonition tip\"><p>Alternatively, press <kbd>Alt</kbd>+<kbd>L</kbd> which will open the attribute details (same view as when an existing attribute is clicked) in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_AlJ73vBCjWDw\">Status bar</a>.</p></aside><h2>Creating a label manually</h2><p>In the&nbsp;<a class=\"reference-link\" href=\"#root/_help_AlJ73vBCjWDw\">Status bar</a>, press the&nbsp;<span class=\"tn-icon bx bx-list-check\"></span> button to show the list of the attributes.</p><ul><li>Click the input box to focus it.</li><li>To create a label called <code>myLabel</code> with no value, simply type <code>#myLabel</code>.</li><li>To create a label called <code>myLabel</code> with a value <code>value</code>, simply type <code>#myLabel=value</code>.</li><li>If the value contains spaces, then the text must be quoted: <code>#myLabel=\"Hello world\"</code>.</li><li>If the string contains quotes (regardless of whether it has spaces), then the text must be quoted with apostrophes instead: <code>#myLabel='Hello \"world\"'</code>.</li><li>To create an inheritable label called <code>myLabel</code>, simply write <code>#myLabel(inheritable)</code> for no value or <code>#myLabel(inheritable)=value</code> if there is a value.</li></ul><h2>Predefined labels</h2><p>This is a list of labels that Trilium natively supports.</p><aside class=\"admonition tip\"><p>Some labels presented here end with a <code>*</code>. 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.</p></aside><figure class=\"table\"><table><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=\"#root/_help_vZWERwf8U3nx\">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=\"#root/_help_vZWERwf8U3nx\">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=\"#root/_help_l0tKav7yLHGF\">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=\"#root/_help_oPVyFC7WL2Lp\">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=\"#root/_help_GPERMystNGTB\">Backend 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>, <code>sortDirection</code>, <code>sortFoldersFirst</code>, <code>sortNatural</code>, <code>sortLocale</code>, <code>top</code>, <code>bottom</code></td><td>Manages automatic/permanent sorting. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_aGlEvb9hyDhS\">Sorting Notes</a>.</td></tr><tr><td><code>hidePromotedAttributes</code></td><td>Hide&nbsp;<a class=\"reference-link\" href=\"#root/_help_OFXdgB2nNk1F\">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 always be <a href=\"#root/_help_CoFPLs3dRlXc\">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=\"#root/_help_CoFPLs3dRlXc\">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=\"#root/_help_AlhDUqhENtH7\">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=\"#root/_help_pKK96zzmvBGf\">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=\"#root/_help_WFGzWeUK6arS\">Customize the Next theme</a>&nbsp;for more information.</td></tr><tr><td><code>customFont</code></td><td>Marks a font as selectable in the Options → Appearance font selection. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_w4rMEhJsALlA\">Personalizing the font</a>.</td></tr><tr><td><code>cssClass</code></td><td>Value of this label is then added as CSS class to the node representing given note in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>. This can be useful for advanced theming. Can be used in template notes.</td></tr><tr><td><code>iconClass</code></td><td>value of this label is added as a CSS class to the icon on the tree which can help visually distinguish the notes in the tree. Example might be bx bx-home - icons are taken from boxicons. Can be used in template notes.</td></tr><tr><td><code>pageSize</code></td><td>Specifies the number of items per page in&nbsp;<a class=\"reference-link\" href=\"#root/_help_0ESUbbAxVnoK\">Note List</a>.</td></tr><tr><td><code>customRequestHandler</code></td><td>See&nbsp;<a class=\"reference-link\" href=\"#root/_help_J5Ex1ZrMbyJ6\">Custom Request Handler</a>.</td></tr><tr><td><code>customResourceProvider</code></td><td>See&nbsp;<a class=\"reference-link\" href=\"#root/_help_d3fAXQ2diepH\">Custom Resource Providers</a>.</td></tr><tr><td><code>widget</code></td><td>Marks this note as a custom widget which will be added to the Trilium component tree. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_MgibgPcfeuGz\">Custom Widgets</a>&nbsp;for more information.</td></tr><tr><td><code>searchHome</code></td><td>New search notes will be created as children of this note (see&nbsp;<a class=\"reference-link\" href=\"#root/_help_m523cpzocqaD\">Saved Search</a>).</td></tr><tr><td><code>workspace</code> and related attributes</td><td>See&nbsp;<a class=\"reference-link\" href=\"#root/_help_9sRHySam5fXb\">Workspaces</a>.</td></tr><tr><td><code>inbox</code></td><td>Default inbox location for new notes. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_S0Fos78ZfcY7\">Note Inbox</a>&nbsp;for more information.</td></tr><tr><td><code>sqlConsoleHome</code></td><td>Default location of&nbsp;<a class=\"reference-link\" href=\"#root/_help_YKWqdJhzi2VY\">SQL Console</a>&nbsp;saved queries.</td></tr><tr><td><code>bookmarked</code></td><td>Indicates this note is a <a href=\"#root/_help_u3YFHC9tQlpm\">bookmark</a>.</td></tr><tr><td><code>bookmarkFolder</code></td><td>Note with this label will appear in bookmarks as folder (allowing access to its children). See&nbsp;<a class=\"reference-link\" href=\"#root/_help_u3YFHC9tQlpm\">Bookmarks</a>&nbsp;for more information.</td></tr><tr><td><code>share*</code></td><td>See the attribute reference in&nbsp;<a class=\"reference-link\" href=\"#root/_help_R9pX4DGra2Vt\">Sharing</a>.</td></tr><tr><td><code>displayRelations</code>, <code>hideRelations</code></td><td>Comma delimited names of relations which should be displayed/hidden in a&nbsp;<a class=\"reference-link\" href=\"#root/_help_iRwzGnHPzonm\">Relation Map</a>&nbsp;(both the note type and the&nbsp;<a class=\"reference-link\" href=\"#root/_help_BCkXAVs63Ttv\">Note Map (Link map, Tree map)</a>&nbsp;general functionality).</td></tr><tr><td><code>titleTemplate</code></td><td>Default title of notes created as children of this note. This value is evaluated as a JavaScript string and thus can be enriched with dynamic content via the injected <code>now</code> and <code>parentNote</code> variables.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br> <br>See&nbsp;<a class=\"reference-link\" href=\"#root/_help_47ZrP6FNuoG8\">Default Note Title</a>&nbsp;for more info.</td></tr><tr><td><code>template</code></td><td>This note will appear in the selection of available template when creating new note. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_KC1HB96bqqHX\">Templates</a>&nbsp;for more information.</td></tr><tr><td><code>color</code></td><td>defines color of the note in note tree, links etc. Use any valid CSS color value like 'red' or #a13d5f&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>Note: this color may be automatically adjusted when displayed to ensure sufficient contrast with the background.</td></tr><tr><td><code>keyboardShortcut</code></td><td>Defines a keyboard shortcut which will immediately jump to this note. Example: 'ctrl+alt+e'. Requires frontend reload for the change to take effect.</td></tr><tr><td><code>keepCurrentHoisting</code></td><td>Opening this link won't change hoisting even if the note is not displayable in the current hoisted subtree.</td></tr><tr><td><code>executeButton</code></td><td>Title of the button which will execute the current code note</td></tr><tr><td><code>executeDescription</code></td><td>Longer description of the current code note displayed together with the execute button</td></tr><tr><td><code>excludeFromNoteMap</code></td><td>Notes with this label will be hidden from the&nbsp;<a class=\"reference-link\" href=\"#root/_help_bdUJEHsAPYQR\">Note Map</a>.</td></tr><tr><td><code>newNotesOnTop</code></td><td>New notes will be created at the top of the parent note, not on the bottom.</td></tr><tr><td><code>hideChildrenOverview</code></td><td>Hides the&nbsp;<a class=\"reference-link\" href=\"#root/_help_0ESUbbAxVnoK\">Note List</a>&nbsp;for that particular note.</td></tr><tr><td><code>subtreeHidden</code></td><td>Hides all child notes of this note from the tree, displaying a badge with the count of hidden children. Children remain accessible via search or direct links.</td></tr><tr><td><code>printLandscape</code></td><td>When exporting to PDF, changes the orientation of the page to landscape instead of portrait.</td></tr><tr><td><code>printPageSize</code></td><td>When exporting to PDF, changes the size of the page. Supported values: <code>A0</code>, <code>A1</code>, <code>A2</code>, <code>A3</code>, <code>A4</code>, <code>A5</code>, <code>A6</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code>, <code>Ledger</code>.</td></tr><tr><td><code>printScale</code>, <code>printMargins</code></td><td>Additional printing options, generally configured through the&nbsp;<a class=\"reference-link\" href=\"#root/_help_NRnIZmSMc5sj\">Printing &amp; Exporting as PDF</a>&nbsp;dialog.</td></tr><tr><td><code>geolocation</code></td><td>Indicates the latitude and longitude of a note, to be displayed in a&nbsp;<a class=\"reference-link\" href=\"#root/_help_81SGnPGMk7Xc\">Geo Map</a>.</td></tr><tr><td><code>geoShape</code></td><td>Indicates the coordinates for the points of a <a href=\"#root/_help_C2H9HK4BzwG7\">shapec</a> drawn on the&nbsp;<a class=\"reference-link\" href=\"#root/_help_81SGnPGMk7Xc\">Geo Map</a>&nbsp;(e.g. area, rectangle, circle).</td></tr><tr><td><code>map:*</code></td><td>Defines specific options for the&nbsp;<a class=\"reference-link\" href=\"#root/_help_81SGnPGMk7Xc\">Geo Map</a>.</td></tr><tr><td><code>calendar:*</code></td><td>Defines specific options for the&nbsp;<a class=\"reference-link\" href=\"#root/_help_xWbu3jpNWapp\">Calendar</a>.</td></tr><tr><td><code>viewType</code></td><td>Sets the view of child notes (e.g. grid or list). See&nbsp;<a class=\"reference-link\" href=\"#root/_help_0ESUbbAxVnoK\">Note List</a>&nbsp;for more information.</td></tr><tr><td><code>webViewSrc</code></td><td>Defines the URL of the&nbsp;<a class=\"reference-link\" href=\"#root/_help_1vHRoWCEjj0L\">Web View</a>.</td></tr><tr><td><code>tabWidth</code>, <code>indentWithTabs</code>, <code>wrapLines</code></td><td>Per-note Code editor settings: indentation width, indent with tabs vs. spaces, and word wrapping. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_6f9hih2hXXZk\">Code</a>.</td></tr><tr><td><code>datePattern</code>, <code>weekPattern</code>, <code>monthPattern</code>, <code>quarterPattern</code>, <code>yearPattern</code></td><td>Customizes the title naming pattern of day / week / month / quarter / year notes. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_l0tKav7yLHGF\">Day Notes</a>.</td></tr><tr><td><code>enableWeekNote</code>, <code>enableQuarterNote</code></td><td>Enables optional week and quarter notes in the calendar hierarchy; set on the calendar root. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_l0tKav7yLHGF\">Day Notes</a>.</td></tr><tr><td><code>fullContentWidth</code></td><td>Expands the note to the full editor width, ignoring the configured content width (useful for wide tables). See&nbsp;<a class=\"reference-link\" href=\"#root/_help_t596jLvPrqkS\">Content width</a>.</td></tr><tr><td><code>iconPack</code></td><td>Identifies a custom icon pack by its prefix. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_g1mlRoU8CsqC\">Creating an icon pack</a>.</td></tr><tr><td><code>clipperInbox</code></td><td>Overrides the default location where the Web Clipper saves clippings (defaults to the day note). See&nbsp;<a class=\"reference-link\" href=\"#root/_help_MtPxeAWVAzMg\">Web Clipper</a>.</td></tr><tr><td><code>docName</code> , <code>docUrl</code></td><td>Used internally for the in-app help.</td></tr><tr><td><code>aiQuickAction</code></td><td>Defines a custom prompt to be used for the&nbsp;<a class=\"reference-link\" href=\"#root/_help_VRoP0g1uHHc2\">In-editor AI assistant</a>'s quick actions.</td></tr></tbody></table></figure>",
+ "_help_HI6GBBIduIgv": "<p>A label is an <a href=\"#root/_help_zEY4DaJG4YT5\">attribute</a> of a note which has a name and optionally a value.</p><h2>Common use cases</h2><ul><li><strong>Metadata for personal use</strong>: Assign labels with optional values for categorization, such as <code>#year=1999</code>, <code>#genre=\"sci-fi\"</code>, or <code>#author=\"Neal Stephenson\"</code>. This can be combined with&nbsp;<a class=\"reference-link\" href=\"#root/_help_OFXdgB2nNk1F\">Promoted Attributes</a>&nbsp;to make their display more user-friendly.</li><li><strong>Configuration</strong>: Labels can configure advanced features or settings (see reference below).</li><li><strong>Scripts and Plugins</strong>: Used to tag notes with special metadata, such as the \"weight\" attribute in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_R7abl2fc6Mxi\">Weight Tracker</a>.</li></ul><h2>Creating a label using the visual editor</h2><ol><li>Go to the&nbsp;<a class=\"reference-link\" href=\"#root/_help_uNtgN0cUKEBc\">Attributes tab</a>&nbsp;in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_RnaPdbciOfeq\">Right Sidebar</a>.</li><li>Press the&nbsp;<span class=\"tn-icon bx bx-plus\"></span> (Add attribute) button at the end of the list, or via the&nbsp;<span class=\"tn-icon bx bx-plus\"></span> button at the top-right of the section → <em>Add new label</em>.</li></ol><p>While in the visual editor:</p><ul><li>Set the desired name.</li><li>Optionally, set the value of the label. Labels can exist without a value.</li><li>Children can inherit this relation, click the relation and check <em>Inheritable</em>. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_bwZpz2ajCEwO\">Attribute Inheritance</a>&nbsp;for more information.</li></ul><aside class=\"admonition tip\"><p>Alternatively, press <kbd>Alt</kbd>+<kbd>L</kbd> which will open the attribute details (same view as when an existing attribute is clicked) in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_AlJ73vBCjWDw\">Status bar</a>.</p></aside><h2>Creating a label manually</h2><p>In the&nbsp;<a class=\"reference-link\" href=\"#root/_help_AlJ73vBCjWDw\">Status bar</a>, press the&nbsp;<span class=\"tn-icon bx bx-list-check\"></span> button to show the list of the attributes.</p><ul><li>Click the input box to focus it.</li><li>To create a label called <code>myLabel</code> with no value, simply type <code>#myLabel</code>.</li><li>To create a label called <code>myLabel</code> with a value <code>value</code>, simply type <code>#myLabel=value</code>.</li><li>If the value contains spaces, then the text must be quoted: <code>#myLabel=\"Hello world\"</code>.</li><li>If the string contains quotes (regardless of whether it has spaces), then the text must be quoted with apostrophes instead: <code>#myLabel='Hello \"world\"'</code>.</li><li>To create an inheritable label called <code>myLabel</code>, simply write <code>#myLabel(inheritable)</code> for no value or <code>#myLabel(inheritable)=value</code> if there is a value.</li></ul><h2>Predefined labels</h2><p>This is a list of labels that Trilium natively supports.</p><aside class=\"admonition tip\"><p>Some labels presented here end with a <code>*</code>. 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.</p></aside><figure class=\"table\"><table><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=\"#root/_help_vZWERwf8U3nx\">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=\"#root/_help_vZWERwf8U3nx\">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=\"#root/_help_l0tKav7yLHGF\">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=\"#root/_help_oPVyFC7WL2Lp\">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=\"#root/_help_GPERMystNGTB\">Backend 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>, <code>sortDirection</code>, <code>sortFoldersFirst</code>, <code>sortNatural</code>, <code>sortLocale</code>, <code>top</code>, <code>bottom</code></td><td>Manages automatic/permanent sorting. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_aGlEvb9hyDhS\">Sorting Notes</a>.</td></tr><tr><td><code>hidePromotedAttributes</code></td><td>Hide&nbsp;<a class=\"reference-link\" href=\"#root/_help_OFXdgB2nNk1F\">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 always be <a href=\"#root/_help_CoFPLs3dRlXc\">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=\"#root/_help_CoFPLs3dRlXc\">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=\"#root/_help_AlhDUqhENtH7\">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=\"#root/_help_pKK96zzmvBGf\">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=\"#root/_help_WFGzWeUK6arS\">Customize the Next theme</a>&nbsp;for more information.</td></tr><tr><td><code>customFont</code></td><td>Marks a font as selectable in the Options → Appearance font selection. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_w4rMEhJsALlA\">Personalizing the font</a>.</td></tr><tr><td><code>cssClass</code></td><td>Value of this label is then added as CSS class to the node representing given note in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>. This can be useful for advanced theming. Can be used in template notes.</td></tr><tr><td><code>iconClass</code></td><td>value of this label is added as a CSS class to the icon on the tree which can help visually distinguish the notes in the tree. Example might be bx bx-home - icons are taken from boxicons. Can be used in template notes.</td></tr><tr><td><code>pageSize</code></td><td>Specifies the number of items per page in&nbsp;<a class=\"reference-link\" href=\"#root/_help_0ESUbbAxVnoK\">Note List</a>.</td></tr><tr><td><code>customRequestHandler</code></td><td>See&nbsp;<a class=\"reference-link\" href=\"#root/_help_J5Ex1ZrMbyJ6\">Custom Request Handler</a>.</td></tr><tr><td><code>customResourceProvider</code></td><td>See&nbsp;<a class=\"reference-link\" href=\"#root/_help_d3fAXQ2diepH\">Custom Resource Providers</a>.</td></tr><tr><td><code>widget</code></td><td>Marks this note as a custom widget which will be added to the Trilium component tree. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_MgibgPcfeuGz\">Custom Widgets</a>&nbsp;for more information.</td></tr><tr><td><code>searchHome</code></td><td>New search notes will be created as children of this note (see&nbsp;<a class=\"reference-link\" href=\"#root/_help_m523cpzocqaD\">Saved Search</a>).</td></tr><tr><td><code>workspace</code> and related attributes</td><td>See&nbsp;<a class=\"reference-link\" href=\"#root/_help_9sRHySam5fXb\">Workspaces</a>.</td></tr><tr><td><code>inbox</code></td><td>Default inbox location for new notes. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_S0Fos78ZfcY7\">Note Inbox</a>&nbsp;for more information.</td></tr><tr><td><code>sqlConsoleHome</code></td><td>Default location of&nbsp;<a class=\"reference-link\" href=\"#root/_help_YKWqdJhzi2VY\">SQL Console</a>&nbsp;saved queries.</td></tr><tr><td><code>bookmarked</code></td><td>Indicates this note is a <a href=\"#root/_help_u3YFHC9tQlpm\">bookmark</a>.</td></tr><tr><td><code>bookmarkFolder</code></td><td>Note with this label will appear in bookmarks as folder (allowing access to its children). See&nbsp;<a class=\"reference-link\" href=\"#root/_help_u3YFHC9tQlpm\">Bookmarks</a>&nbsp;for more information.</td></tr><tr><td><code>share*</code></td><td>See the attribute reference in&nbsp;<a class=\"reference-link\" href=\"#root/_help_R9pX4DGra2Vt\">Sharing</a>.</td></tr><tr><td><code>displayRelations</code>, <code>hideRelations</code></td><td>Comma delimited names of relations which should be displayed/hidden in a&nbsp;<a class=\"reference-link\" href=\"#root/_help_iRwzGnHPzonm\">Relation Map</a>&nbsp;(both the note type and the&nbsp;<a class=\"reference-link\" href=\"#root/_help_BCkXAVs63Ttv\">Note Map (Link map, Tree map)</a>&nbsp;general functionality).</td></tr><tr><td><code>titleTemplate</code></td><td>Default title of notes created as children of this note. This value is evaluated as a JavaScript string and thus can be enriched with dynamic content via the injected <code>now</code> and <code>parentNote</code> variables.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br> <br>See&nbsp;<a class=\"reference-link\" href=\"#root/_help_47ZrP6FNuoG8\">Default Note Title</a>&nbsp;for more info.</td></tr><tr><td><code>template:titleTemplate</code></td><td>Set on a template note: default title of notes created from the template, taking precedence over the parent's <code>titleTemplate</code>. Evaluated the same way as <code>titleTemplate</code>. See <a class=\"reference-link\" href=\"#root/_help_47ZrP6FNuoG8\">Default Note Title</a>.</td></tr><tr><td><code>template</code></td><td>This note will appear in the selection of available template when creating new note. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_KC1HB96bqqHX\">Templates</a>&nbsp;for more information.</td></tr><tr><td><code>color</code></td><td>defines color of the note in note tree, links etc. Use any valid CSS color value like 'red' or #a13d5f&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>Note: this color may be automatically adjusted when displayed to ensure sufficient contrast with the background.</td></tr><tr><td><code>keyboardShortcut</code></td><td>Defines a keyboard shortcut which will immediately jump to this note. Example: 'ctrl+alt+e'. Requires frontend reload for the change to take effect.</td></tr><tr><td><code>keepCurrentHoisting</code></td><td>Opening this link won't change hoisting even if the note is not displayable in the current hoisted subtree.</td></tr><tr><td><code>executeButton</code></td><td>Title of the button which will execute the current code note</td></tr><tr><td><code>executeDescription</code></td><td>Longer description of the current code note displayed together with the execute button</td></tr><tr><td><code>excludeFromNoteMap</code></td><td>Notes with this label will be hidden from the&nbsp;<a class=\"reference-link\" href=\"#root/_help_bdUJEHsAPYQR\">Note Map</a>.</td></tr><tr><td><code>newNotesOnTop</code></td><td>New notes will be created at the top of the parent note, not on the bottom.</td></tr><tr><td><code>hideChildrenOverview</code></td><td>Hides the&nbsp;<a class=\"reference-link\" href=\"#root/_help_0ESUbbAxVnoK\">Note List</a>&nbsp;for that particular note.</td></tr><tr><td><code>subtreeHidden</code></td><td>Hides all child notes of this note from the tree, displaying a badge with the count of hidden children. Children remain accessible via search or direct links.</td></tr><tr><td><code>printLandscape</code></td><td>When exporting to PDF, changes the orientation of the page to landscape instead of portrait.</td></tr><tr><td><code>printPageSize</code></td><td>When exporting to PDF, changes the size of the page. Supported values: <code>A0</code>, <code>A1</code>, <code>A2</code>, <code>A3</code>, <code>A4</code>, <code>A5</code>, <code>A6</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code>, <code>Ledger</code>.</td></tr><tr><td><code>printScale</code>, <code>printMargins</code></td><td>Additional printing options, generally configured through the&nbsp;<a class=\"reference-link\" href=\"#root/_help_NRnIZmSMc5sj\">Printing &amp; Exporting as PDF</a>&nbsp;dialog.</td></tr><tr><td><code>geolocation</code></td><td>Indicates the latitude and longitude of a note, to be displayed in a&nbsp;<a class=\"reference-link\" href=\"#root/_help_81SGnPGMk7Xc\">Geo Map</a>.</td></tr><tr><td><code>geoShape</code></td><td>Indicates the coordinates for the points of a <a href=\"#root/_help_C2H9HK4BzwG7\">shapec</a> drawn on the&nbsp;<a class=\"reference-link\" href=\"#root/_help_81SGnPGMk7Xc\">Geo Map</a>&nbsp;(e.g. area, rectangle, circle).</td></tr><tr><td><code>map:*</code></td><td>Defines specific options for the&nbsp;<a class=\"reference-link\" href=\"#root/_help_81SGnPGMk7Xc\">Geo Map</a>.</td></tr><tr><td><code>calendar:*</code></td><td>Defines specific options for the&nbsp;<a class=\"reference-link\" href=\"#root/_help_xWbu3jpNWapp\">Calendar</a>.</td></tr><tr><td><code>viewType</code></td><td>Sets the view of child notes (e.g. grid or list). See&nbsp;<a class=\"reference-link\" href=\"#root/_help_0ESUbbAxVnoK\">Note List</a>&nbsp;for more information.</td></tr><tr><td><code>webViewSrc</code></td><td>Defines the URL of the&nbsp;<a class=\"reference-link\" href=\"#root/_help_1vHRoWCEjj0L\">Web View</a>.</td></tr><tr><td><code>tabWidth</code>, <code>indentWithTabs</code>, <code>wrapLines</code></td><td>Per-note Code editor settings: indentation width, indent with tabs vs. spaces, and word wrapping. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_6f9hih2hXXZk\">Code</a>.</td></tr><tr><td><code>datePattern</code>, <code>weekPattern</code>, <code>monthPattern</code>, <code>quarterPattern</code>, <code>yearPattern</code></td><td>Customizes the title naming pattern of day / week / month / quarter / year notes. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_l0tKav7yLHGF\">Day Notes</a>.</td></tr><tr><td><code>enableWeekNote</code>, <code>enableQuarterNote</code></td><td>Enables optional week and quarter notes in the calendar hierarchy; set on the calendar root. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_l0tKav7yLHGF\">Day Notes</a>.</td></tr><tr><td><code>fullContentWidth</code></td><td>Expands the note to the full editor width, ignoring the configured content width (useful for wide tables). See&nbsp;<a class=\"reference-link\" href=\"#root/_help_t596jLvPrqkS\">Content width</a>.</td></tr><tr><td><code>iconPack</code></td><td>Identifies a custom icon pack by its prefix. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_g1mlRoU8CsqC\">Creating an icon pack</a>.</td></tr><tr><td><code>clipperInbox</code></td><td>Overrides the default location where the Web Clipper saves clippings (defaults to the day note). See&nbsp;<a class=\"reference-link\" href=\"#root/_help_MtPxeAWVAzMg\">Web Clipper</a>.</td></tr><tr><td><code>docName</code> , <code>docUrl</code></td><td>Used internally for the in-app help.</td></tr><tr><td><code>aiQuickAction</code></td><td>Defines a custom prompt to be used for the&nbsp;<a class=\"reference-link\" href=\"#root/_help_VRoP0g1uHHc2\">In-editor AI assistant</a>'s quick actions.</td></tr></tbody></table></figure>",
"_help_Cq5X6iKQop6R": "<p>A relation is similar to a <a href=\"#root/_help_HI6GBBIduIgv\">label</a>, but instead of having a text value it refers to another note.</p><h2>Common use cases</h2><ul><li><strong>Metadata Relationships for personal use</strong>: For example, linking a book note to an author note.<br>This can be combined with&nbsp;<a class=\"reference-link\" href=\"#root/_help_OFXdgB2nNk1F\">Promoted Attributes</a>&nbsp;to make their display more user-friendly.</li><li><strong>Configuration</strong>: For configuring some notes such as&nbsp;<a class=\"reference-link\" href=\"#root/_help_HcABDtFCkbFN\">Render Note</a>, or configuring&nbsp;<a class=\"reference-link\" href=\"#root/_help_R9pX4DGra2Vt\">Sharing</a>&nbsp;or&nbsp;<a class=\"reference-link\" href=\"#root/_help_KC1HB96bqqHX\">Templates</a>&nbsp;(see the list below).</li><li><strong>Scripting</strong>: Attaching scripts to events or conditions related to the note.</li></ul><h2>Creating a relation using the visual editor</h2><ol><li>Go to the&nbsp;<a class=\"reference-link\" href=\"#root/_help_uNtgN0cUKEBc\">Attributes tab</a>&nbsp;in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_RnaPdbciOfeq\">Right Sidebar</a>.</li><li>Press the&nbsp;<span class=\"tn-icon bx bx-plus\"></span> button (<em>Add a new attribute</em>) to the right of the <em>Owned attributes</em> section.</li><li>Select <em>Add new relation</em> for the relation.</li></ol><p>While in the visual editor, set the desired name and the <em>Target note</em> (the note to point to). Unlike labels, relations cannot exist with a target note.</p><p>Children can inherit this relation, click the relation and check <em>Inheritable</em>. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_bwZpz2ajCEwO\">Attribute Inheritance</a>&nbsp;for more information.</p><aside class=\"admonition tip\"><p>Alternatively, press <kbd>Alt</kbd>+<kbd>L</kbd> which will open the attribute details (same view as when an existing attribute is clicked) in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_AlJ73vBCjWDw\">Status bar</a>.</p></aside><h2>Creating a relation manually</h2><p>In the&nbsp;<a class=\"reference-link\" href=\"#root/_help_AlJ73vBCjWDw\">Status bar</a>, press the&nbsp;<span class=\"tn-icon bx bx-list-check\"></span> button to show the list of the attributes.</p><ul><li>To create a relation called <code>myRelation</code>:<ol><li>Click the input box to focus it.</li><li>Type <code>~myRelation=@</code> .</li><li>After this, an autocompletion box should appear.</li><li>Type the title of the note to point to and press <kbd>Enter</kbd> to confirm (or click the desired note).</li><li>Alternatively copy a note from the&nbsp;<a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>&nbsp;and paste it after the <code>=</code> sign (without the <code>@</code> , in this case).</li></ol></li><li>To create an inheritable relation, follow the same steps as previously described but instead of <code>~myRelation</code> write <code>~myRelation(inheritable)</code>.</li></ul><h2>Predefined relations</h2><p>These relations are supported and used internally by Trilium.</p><figure class=\"table\"><table><thead><tr><th>Label</th><th>Description</th></tr></thead><tbody><tr><td><code>runOn*</code></td><td>See&nbsp;<a class=\"reference-link\" href=\"#root/_help_GPERMystNGTB\">Backend 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>template:newNoteDefaultParent</code></td><td>set on a template note, points to the note under which notes created from the template are placed when no other location is picked; when set several times, the note is cloned into every target. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_KC1HB96bqqHX\">Templates</a>.</td></tr><tr><td><code>inherit</code></td><td>note's attributes will be inherited even without a parent-child relationship. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_KC1HB96bqqHX\">Templates</a>&nbsp;for a similar concept. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_bwZpz2ajCEwO\">Attribute Inheritance</a>&nbsp;in the documentation.</td></tr><tr><td><code>renderNote</code></td><td>notes of type&nbsp;<a class=\"reference-link\" href=\"#root/_help_HcABDtFCkbFN\">Render Note</a>&nbsp;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</code></td><td>Used in the context of custom&nbsp;<a class=\"reference-link\" href=\"#root/_help_4Gn3psZKsfSm\">Launch Bar Widgets</a>, to refer to the widget that will be rendered.</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>shareHiddenFromTree</code> and <code>shareOmitDefaultCss</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>shareHiddenFromTree</code>.</td></tr><tr><td><code>shareHtml</code></td><td>HTML note which will be injected into the share page at locations specified by the <code>shareHtmlLocation</code> label. HTML note must be in the shared sub-tree as well. Consider using <code>shareHiddenFromTree</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>shareHiddenFromTree</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>shareHiddenFromTree</code>.</td></tr></tbody></table></figure>",
"_help_bwZpz2ajCEwO": "<p>Inheritance refers to the process of having a <a href=\"#root/_help_HI6GBBIduIgv\">label</a> or a <a href=\"#root/_help_Cq5X6iKQop6R\">relation</a> shared across multiple notes, generally in parent-child relations (or anywhere if using templates).</p><h2>Standard Inheritance</h2><p>In Trilium, attributes can be automatically inherited by child notes if they have the <code>isInheritable</code> flag set to <code>true</code>. This means the attribute (a key-value pair) is applied to the note and all its descendants.</p><p>To make an attribute inheritable, simply use the visual editor for&nbsp;<a class=\"reference-link\" href=\"#root/_help_HI6GBBIduIgv\">Labels</a>&nbsp;or&nbsp;<a class=\"reference-link\" href=\"#root/_help_Cq5X6iKQop6R\">Relations</a>. Alternatively, the attribute can be manually defined where <code>#myLabel=value</code> becomes <code>#myLabel(inheritable)=value</code> when inheritable.</p><p>As an example, the <code>archived</code> 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.</p><p>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 <em>copying inheritance</em> or <em>template inheritance</em> needs to be used instead.</p><h2>Copying Inheritance</h2><p>Copying inheritance differs from standard inheritance by using a <code>child:</code> 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.</p><p>If a parent note has the label <code>#child:exampleAttribute</code>, all newly created child notes (one level deep) will inherit the <code>#exampleAttribute</code> label. This can be useful for setting default properties for notes in a specific section.</p><p>Similarly, for relations use <code>~child:myRelation</code>.</p><p>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.</p><h3>Chained inheritance</h3><p>It is possible to define labels across multiple levels of depth. For example, <code>#child:child:child:foo</code> applied to a root note would create:</p><ul><li><code>#child:child:foo</code> on the first-level children.</li><li><code>#child:foo</code> on the second-level children.</li><li><code>#foo</code> on the third-level children.</li></ul><p>Similarly, use <code>~child:child:child:foo</code> if dealing with relations.</p><p>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.</p><h2>Template Inheritance</h2><p>Attributes can also be inherited from&nbsp;<a class=\"reference-link\" href=\"#root/_help_KC1HB96bqqHX\">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.</p>",
"_help_OFXdgB2nNk1F": "<figure class=\"image image_resized\" style=\"width:61.4%;\"><img style=\"aspect-ratio:938/368;\" src=\"{{helpAssets}}/User%20Guide/Advanced%20Usage/Attributes/Promoted%20Attributes_image.png\" width=\"938\" height=\"368\"></figure><p>Promoted attributes are <a href=\"#root/_help_zEY4DaJG4YT5\">attributes</a> which are displayed prominently in the UI which allow them to be easily viewed and edited.</p><p>The promoted attributes are shown underneath the&nbsp;<a class=\"reference-link\" href=\"#root/_help_l7pigIGu01K2\">Title</a>&nbsp;of the note, in a collapsible section. For full-height notes such as&nbsp;<a class=\"reference-link\" href=\"#root/_help_grjYqerjn243\">Canvas</a>, the promoted attributes are collapsed by default to make room.</p><p>One way of seeing promoted attributes is as a kind of form with several fields. Each field is just regular attribute, the only difference is that they appear on the note itself.</p><p>Attributes can be pretty useful since they allow for querying and script automation etc. but they are also inconveniently hidden. This allows you to select few of the important ones and push them to the front of the user.</p><h2>Attribute definition</h2><figure class=\"image image-style-align-right image_resized\" style=\"width:50%;\"><img style=\"aspect-ratio:885/742;\" src=\"{{helpAssets}}/User%20Guide/Advanced%20Usage/Attributes/2_Promoted%20Attributes_image.png\" width=\"885\" height=\"742\"></figure><p>In order to have promoted attributes, there needs to be a way to define them.</p><p>Technically, attributes are only name-value pairs where both name and value are strings.</p><p>The <em>Attribute definition</em> specifies how should this value be interpreted:</p><ul><li>Is it just string, or is it a date?</li><li>Should we allow multiple values or note?</li><li>Should we <em>promote</em> the attribute or not?</li></ul><h2>Types of attributes</h2><p>Attribute definitions have a dedicated type field which will change how the value will be edited in the promoted attributes section.</p><p>The following types are supported:</p><ul><li><em>Text</em>, the default option which allows any type of text to be edited, similar to normal labels that don't have a type associated.</li><li><em>Multi-line text</em>, similar to a normal text field, but rendered in a bigger text box that also supports writing on multiple lines.</li><li><em>Number</em>, will display as a number input field with up/down arrows.<ul><li>Optionally a <em>precision</em> which sets how many decimals the value steps by and is displayed with.</li></ul></li><li><em>Checkbox</em>, which renders as a checkbox for a true/false value. In the label definition, this type is written as <code>boolean</code>.</li><li><em>Select,</em> which provides a list of user-defined options when editing.<ul><li>The list is not fixed, meaning that new options can be easily added from the promoted attribute.</li><li>Renaming an option does not change the existing values since the value is stored as text. Consider a <a href=\"#root/_help_ivYnonVFBxbQ\">bulk rename</a>.</li><li>The items do not have a custom color or icon. This is intentional as selects are meant to be light-weight. For a more customizable option, consider using&nbsp;<a class=\"reference-link\" href=\"#root/_help_Cq5X6iKQop6R\">Relations</a>&nbsp;instead which use notes as items and those notes can be colorized and also carry an icon.</li></ul></li><li><em>Date,</em> which provides a date picker.</li><li><em>Date &amp; Time,</em> which provides a date &amp; time picker.</li><li><em>Time,</em> which provides a time picker.</li><li><em>URL,</em> which provides a button to open the web address in a new window.</li><li><em>Email</em>, which provides a button to quickly send an email to that address using your operating system's default app.</li><li><em>Phone</em>, which provides a button to quickly call that number using your operating system's default app.</li><li><em>Color</em>, which provides a color picker and a way to remove the value.</li><li><em>Relation</em>, which points to another note and uses&nbsp;<a class=\"reference-link\" href=\"#root/_help_Cq5X6iKQop6R\">Relations</a>&nbsp;instead of&nbsp;<a class=\"reference-link\" href=\"#root/_help_HI6GBBIduIgv\">Labels</a>.</li></ul><aside class=\"admonition note\"><p>For label-based attributes, these types are not enforced by the attribute system, meaning that changing the type afterwards does not guarantee that the values in it correspond to the type (e.g. turning a text into a number).</p></aside><h2>Multiple values</h2><p>When the definition allows multiple values, each value is shown as a chip and a new one is added in the box after them. Press the <span class=\"tn-icon bx bx-x\"></span> on a chip to remove that value.</p><ul><li>For free-form types such as <em>Text</em>, <em>Number</em> or <em>Date</em>, press <kbd>Enter</kbd> (or leave the field) to add what was typed. The same value can be added more than once, for example two payments of the same amount.</li><li>For <em>Select</em>, <em>Checkbox</em> and <em>Relation</em> attributes, a value is picked from the list rather than typed, and each one can be picked only once.</li></ul><h2>Creating a new promoted attribute definition</h2><p>To create a new promoted attribute:</p><ol><li>Go to a note.</li><li>Go to the&nbsp;<a class=\"reference-link\" href=\"#root/_help_uNtgN0cUKEBc\">Attributes tab</a>&nbsp;in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_RnaPdbciOfeq\">Right Sidebar</a>.</li><li>Press the&nbsp;<span class=\"tn-icon bx bx-plus\"></span> button for the top-most section (<em>Owned attributes</em>).</li><li>Select either <em>Add new label definition…</em> or <em>Add new relation definition…</em>.</li><li>Select the name which will be name of the label or relation that will be created when the promoted attribute is edited.</li><li>Ensure <em>Promoted</em> is checked in order to display it at the top of notes.</li><li>Optionally, choose an <em>Alias</em> which will be displayed next to the promoted attribute instead of the attribute name. Generally it's best to choose a “user-friendly” name since it can contain spaces and other characters which are not supported as attribute names.</li><li>Check <em>Inheritable</em> to apply it to this note and all its descendants. To keep it only for the current note, un-check it.</li><li>Press <em>Save &amp; Close</em> to apply the changes.</li></ol><p>Alternatively, promoted attributes can be created from the&nbsp;<a class=\"reference-link\" href=\"#root/_help_AlJ73vBCjWDw\">Status bar</a>&nbsp;by going to&nbsp;<span class=\"tn-icon bx bx-list-check\"></span> (<em>Attributes</em>), pressing the&nbsp;<span class=\"tn-icon bx bx-plus\"></span> button and selecting <em>Add new label definition…</em>. The resulting attribute can also be copy-pasted or written manually (albeit discouraged).</p><h2>How attribute definitions actually work</h2><p>When a new promoted attribute definition is created, it creates a corresponding label prefixed with either <code>label</code> or <code>relation</code>, depending on the definition type:</p><pre><code class=\"language-text-x-trilium-auto\">#label:myColor(inheritable)=\"promoted,alias=Color,multi,color\"</code></pre><p>The only purpose of the attribute definition is to set up a template. If the attribute was marked as promoted, then it's also displayed to the user for easy editing.</p><figure class=\"table\"><table><tbody><tr><td><figure class=\"image\"><img style=\"aspect-ratio:495/157;\" src=\"{{helpAssets}}/User%20Guide/Advanced%20Usage/Attributes/1_Promoted%20Attributes_image.png\" width=\"495\" height=\"157\"></figure></td><td>Notice how the promoted attribute definition only creates a “Due date” box above the text content.</td></tr><tr><td><figure class=\"image\"><img style=\"aspect-ratio:663/160;\" src=\"{{helpAssets}}/User%20Guide/Advanced%20Usage/Attributes/3_Promoted%20Attributes_image.png\" width=\"663\" height=\"160\"></figure></td><td>Once a value is set by the user, a new label (or relation, depending on the type) is created. The name of the attribute matches one set when creating the promoted attribute.</td></tr></tbody></table></figure><p>So there's one attribute for value and one for definition. But notice how an definition attribute can be made <a href=\"#root/_help_bwZpz2ajCEwO\">Inheritable</a>, meaning that it's also applied to all descendant notes. In this case, the definition used for the whole sub-tree while \"value\" attributes are for each not individually.</p><h2>Using system attributes</h2><p>It's possible to create promoted attributes out of system attributes, to be able to easily alter them.</p><p>Here are a few practical examples:</p><ul><li><a class=\"reference-link\" href=\"#root/_help_GTwFsgaA0lCt\">Collections</a>&nbsp;already make use of this practice, for example:<ul><li>Calendars add “Start Date”, “End Date”, “Start Time” and “End Time” as promoted attributes. These map to system attributes such as <code>startDate</code> which are then interpreted by the calendar view.</li><li><a class=\"reference-link\" href=\"#root/_help_zP3PMqaG71Ct\">Presentation</a>&nbsp;adds a “Background” promoted attribute for each of the slide to easily be able to customize.</li></ul></li><li>The Trilium documentation (which is edited in Trilium) uses a promoted attribute to be able to easily edit the <code>#shareAlias</code> (see&nbsp;<a class=\"reference-link\" href=\"#root/_help_R9pX4DGra2Vt\">Sharing</a>) in order to form clean URLs.</li><li>If you always edit a particular system attribute such as <code>#color</code>, simply create a promoted attribute for it to make it easier.</li></ul><h3>Inverse relation</h3><p>Some relations always occur in pairs - my favorite example is on the family. If you have a note representing husband and note representing wife, then there might be a relation between those two of <code>isPartnerOf</code>. This is bidirectional relationship - meaning that if a relation is pointing from husband to wife then there should be always another relation pointing from wife to husband.</p><p>Another example is with parent-child relationship. Again these always occur in pairs, but in this case it's not exact same relation - the one going from parent to child might be called <code>isParentOf</code> and the other one going from child to parent might be called <code>isChildOf</code>.</p><p>Relation definition allows you to specify such \"inverse relation\" - for the relation you just define you specify which is the inverse relation. Note that in the second example we should have two relation definitions - one for <code>isParentOf</code> which defines <code>isChildOf</code> as inverse relation and then second relation definition for <code>isChildOf</code> which defines <code>isParentOf</code> as inverse relation.</p><p>What this does internally is that whenever we save a relation which has defined inverse relation, we check that this inverse relation exists on the relation target note. Similarly, when we delete relation, we also delete inverse relation on the target note.</p><h2>See also</h2><ul><li>The&nbsp;<a class=\"reference-link\" href=\"#root/_help_2FvYrpmOXm29\">Table</a>&nbsp;collection makes heavy use of promoted attributes to define the columns of the table, since they already carry the type information. When made inheritable, it's also easy to change those fields when the child notes are opened.</li></ul>",
- "_help_KC1HB96bqqHX": "<p>A template in Trilium serves as a predefined structure for other notes, referred to as instance notes. Assigning a template to a note brings three main effects:</p><ol><li><strong>Attribute Inheritance</strong>: All attributes from the template note are <a href=\"#root/_help_bwZpz2ajCEwO\">inherited</a> by the instance notes. Even attributes with <code>#isInheritable=false</code> are inherited by the instance notes, although only inheritable attributes are further inherited by the children of the instance notes.</li><li><strong>Content Duplication</strong>: The content of the template note is copied to the instance note, provided the instance note is empty at the time of template assignment.</li><li><strong>Child Note Duplication</strong>: All child notes of the template are deep-duplicated to the instance note.</li></ol><h2>Example</h2><p>A typical example would be a \"Book\" template note, which might include:</p><ul><li><strong>Promoted Attributes</strong>: Such as publication year, author, etc. (see <a href=\"#root/_help_OFXdgB2nNk1F\">promoted attributes</a>).</li><li><strong>Outline</strong>: An outline for a book review, including sections like themes, conclusion, etc.</li><li><strong>Child Notes</strong>: Additional notes for highlights, summary, etc.</li></ul><p><img src=\"{{helpAssets}}/User%20Guide/Advanced%20Usage/Templates_template.png\" alt=\"Template Example\"></p><h2>Instance Note</h2><p>An instance note is a note related to a template note. This relationship means the instance note's content is initialized from the template, and all attributes from the template are inherited.</p><p>To create an instance note through the UI:</p><p><img src=\"{{helpAssets}}/User%20Guide/Advanced%20Usage/Templates_template-create-instance-note.png\" alt=\"show child note templates\"></p><p>For the template to appear in the menu, the template note must have the <code>#template</code> label. Do not confuse this with the <code>~template</code> relation, which links the instance note to the template note. If you use <a href=\"#root/_help_9sRHySam5fXb\">workspaces</a>, you can also mark templates with <code>#workspaceTemplate</code> to display them only in the workspace.</p><p>Templates can also be added or changed after note creation by creating a <code>~template</code> relation pointing to the desired template note.&nbsp;</p><p>To specify a template for child notes, you can use a <code>~child:template</code> relation pointing to the appropriate template note. There is no limit to the depth of the hierarchy — you can use <code>~child:child:template</code>, <code>~child:child:child:template</code>, and so on.</p><aside class=\"admonition important\"><p>Changing the template hierarchy after the parent note is created will not retroactively apply to newly created child notes.<br>For example, if you initially use <code>~child:template</code> and later switch to <code>~child:child:template</code>, it will not automatically apply the new template to the grandchild notes. Only the structure present at the time of note creation is considered.</p></aside><h2>Default parent for new notes</h2><p>A template can gather the notes created from it in one place, instead of having them land wherever they happen to be created. To do so, add a <code>~template:newNoteDefaultParent</code> relation to the template note, pointing at the note that should hold the instances, for example a <em>Person</em> template pointing to a <em>People</em> note.</p><p>Adding the relation several times places the new note in every target, as&nbsp;<a class=\"reference-link\" href=\"#root/_help_IakOLONlIfGI\">Cloning Notes</a>. The relation can also be inherited (e.g. from a folder holding several templates), in which case a relation owned by the template itself replaces the inherited one. The default parent is only inherited from the template's ancestors in the tree: a template created from another template does not adopt that template's default parent.</p><p>The default parent is used whenever a note is created from the template through the <em>Choose note type</em> dialog:</p><ul><li>Via <code>@</code>-completion in a&nbsp;<a class=\"reference-link\" href=\"#root/_help_iPIMuisry3hd\">Text</a>&nbsp;note</li><li>Via the <em>Create note</em> or <em>Create child note</em> options of the note search (new tab or&nbsp;<a class=\"reference-link\" href=\"#root/_help_hrZ1D00cLbal\">Internal (reference) links</a>), but only if the default/empty location is set.</li></ul><p>Creating an instance note from the&nbsp;<a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>&nbsp;context menu (<em>Insert child note</em>, <em>Insert note after</em>) still creates it at the chosen place.</p><p>Unlike the&nbsp;<a class=\"reference-link\" href=\"#root/_help_S0Fos78ZfcY7\">Note Inbox</a>, which holds quickly captured notes until they are sorted, the default parent is meant as the instances' permanent location.</p><h2>Regarding note types</h2><p>By default, newly created notes are&nbsp;<a class=\"reference-link\" href=\"#root/_help_iPIMuisry3hd\">Text</a>&nbsp;notes. If a parent note defines a <code>child:template</code> pointing to a template of a different type (e.g. a Code note), the behavior depends on how the new note is created:</p><ul><li>If no note type is explicitly chosen (e.g. the + button in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>), the template is applied and the new note takes the type and content of the template.</li><li>If a note type is explicitly selected (e.g.&nbsp;<a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>&nbsp;→ <em>Insert note after</em> / <em>Insert child note</em>):<ul><li>If the selected type matches the template's type, the template is applied.</li><li>If the selected type differs, the template is disregarded entirely — the new note is an empty note of the selected type.</li></ul></li></ul><p>Selecting a specific template from the creation menu always takes precedence over <code>child:template</code>.</p><h2>Additional Notes</h2><p>From a visual perspective, templates can define <code>#iconClass</code> and <code>#cssClass</code> attributes, allowing all instance notes (e.g., books) to display a specific icon and CSS style.</p><p>Explore the concept further in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_6tZeKvSHEUiB\">Demo Notes</a>, including examples like the&nbsp;<a class=\"reference-link\" href=\"#root/_help_iRwzGnHPzonm\">Relation Map</a>,&nbsp;<a class=\"reference-link\" href=\"#root/_help_xYjQUYhpbUEW\">Task Manager</a>, and&nbsp;<a class=\"reference-link\" href=\"#root/_help_l0tKav7yLHGF\">Day Notes</a>.</p><p>Additionally, see&nbsp;<a class=\"reference-link\" href=\"#root/_help_47ZrP6FNuoG8\">Default Note Title</a>&nbsp;for creating title templates. Note templates and title templates can be combined by creating a <code>#titleTemplate</code> for a template note.</p>",
+ "_help_KC1HB96bqqHX": "<p>A template in Trilium serves as a predefined structure for other notes, referred to as instance notes. Assigning a template to a note brings three main effects:</p><ol><li><strong>Attribute Inheritance</strong>: All attributes from the template note are <a href=\"#root/_help_bwZpz2ajCEwO\">inherited</a> by the instance notes. Even attributes with <code>#isInheritable=false</code> are inherited by the instance notes, although only inheritable attributes are further inherited by the children of the instance notes.</li><li><strong>Content Duplication</strong>: The content of the template note is copied to the instance note, provided the instance note is empty at the time of template assignment.</li><li><strong>Child Note Duplication</strong>: All child notes of the template are deep-duplicated to the instance note.</li></ol><h2>Example</h2><p>A typical example would be a \"Book\" template note, which might include:</p><ul><li><strong>Promoted Attributes</strong>: Such as publication year, author, etc. (see <a href=\"#root/_help_OFXdgB2nNk1F\">promoted attributes</a>).</li><li><strong>Outline</strong>: An outline for a book review, including sections like themes, conclusion, etc.</li><li><strong>Child Notes</strong>: Additional notes for highlights, summary, etc.</li></ul><p><img src=\"{{helpAssets}}/User%20Guide/Advanced%20Usage/Templates_template.png\" alt=\"Template Example\"></p><h2>Instance Note</h2><p>An instance note is a note related to a template note. This relationship means the instance note's content is initialized from the template, and all attributes from the template are inherited.</p><p>To create an instance note through the UI:</p><p><img src=\"{{helpAssets}}/User%20Guide/Advanced%20Usage/Templates_template-create-instance-note.png\" alt=\"show child note templates\"></p><p>For the template to appear in the menu, the template note must have the <code>#template</code> label. Do not confuse this with the <code>~template</code> relation, which links the instance note to the template note. If you use <a href=\"#root/_help_9sRHySam5fXb\">workspaces</a>, you can also mark templates with <code>#workspaceTemplate</code> to display them only in the workspace.</p><p>Templates can also be added or changed after note creation by creating a <code>~template</code> relation pointing to the desired template note.&nbsp;</p><p>To specify a template for child notes, you can use a <code>~child:template</code> relation pointing to the appropriate template note. There is no limit to the depth of the hierarchy — you can use <code>~child:child:template</code>, <code>~child:child:child:template</code>, and so on.</p><aside class=\"admonition important\"><p>Changing the template hierarchy after the parent note is created will not retroactively apply to newly created child notes.<br>For example, if you initially use <code>~child:template</code> and later switch to <code>~child:child:template</code>, it will not automatically apply the new template to the grandchild notes. Only the structure present at the time of note creation is considered.</p></aside><h2>Default parent for new notes</h2><p>A template can gather the notes created from it in one place, instead of having them land wherever they happen to be created. To do so, add a <code>~template:newNoteDefaultParent</code> relation to the template note, pointing at the note that should hold the instances, for example a <em>Person</em> template pointing to a <em>People</em> note.</p><p>Adding the relation several times places the new note in every target, as&nbsp;<a class=\"reference-link\" href=\"#root/_help_IakOLONlIfGI\">Cloning Notes</a>. The relation can also be inherited (e.g. from a folder holding several templates), in which case a relation owned by the template itself replaces the inherited one. The default parent is only inherited from the template's ancestors in the tree: a template created from another template does not adopt that template's default parent.</p><p>The default parent is used whenever a note is created from the template through the <em>Choose note type</em> dialog:</p><ul><li>Via <code>@</code>-completion in a&nbsp;<a class=\"reference-link\" href=\"#root/_help_iPIMuisry3hd\">Text</a>&nbsp;note</li><li>Via the <em>Create note</em> or <em>Create child note</em> options of the note search (new tab or&nbsp;<a class=\"reference-link\" href=\"#root/_help_hrZ1D00cLbal\">Internal (reference) links</a>), but only if the default/empty location is set.</li></ul><p>Creating an instance note from the&nbsp;<a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>&nbsp;context menu (<em>Insert child note</em>, <em>Insert note after</em>) still creates it at the chosen place.</p><p>Unlike the&nbsp;<a class=\"reference-link\" href=\"#root/_help_S0Fos78ZfcY7\">Note Inbox</a>, which holds quickly captured notes until they are sorted, the default parent is meant as the instances' permanent location.</p><h2>Regarding note types</h2><p>By default, newly created notes are&nbsp;<a class=\"reference-link\" href=\"#root/_help_iPIMuisry3hd\">Text</a>&nbsp;notes. If a parent note defines a <code>child:template</code> pointing to a template of a different type (e.g. a Code note), the behavior depends on how the new note is created:</p><ul><li>If no note type is explicitly chosen (e.g. the + button in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>), the template is applied and the new note takes the type and content of the template.</li><li>If a note type is explicitly selected (e.g.&nbsp;<a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>&nbsp;→ <em>Insert note after</em> / <em>Insert child note</em>):<ul><li>If the selected type matches the template's type, the template is applied.</li><li>If the selected type differs, the template is disregarded entirely — the new note is an empty note of the selected type.</li></ul></li></ul><p>Selecting a specific template from the creation menu always takes precedence over <code>child:template</code>.</p><h2>Default title for new notes</h2><p>A template can also give its instances a default title, using the <code>#template:titleTemplate</code> label. See <a class=\"reference-link\" href=\"#root/_help_47ZrP6FNuoG8\">Default Note Title</a> for details.</p><h2>Additional Notes</h2><p>From a visual perspective, templates can define <code>#iconClass</code> and <code>#cssClass</code> attributes, allowing all instance notes (e.g., books) to display a specific icon and CSS style.</p><p>Explore the concept further in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_6tZeKvSHEUiB\">Demo Notes</a>, including examples like the&nbsp;<a class=\"reference-link\" href=\"#root/_help_iRwzGnHPzonm\">Relation Map</a>,&nbsp;<a class=\"reference-link\" href=\"#root/_help_xYjQUYhpbUEW\">Task Manager</a>, and&nbsp;<a class=\"reference-link\" href=\"#root/_help_l0tKav7yLHGF\">Day Notes</a>.</p><p>Additionally, see&nbsp;<a class=\"reference-link\" href=\"#root/_help_47ZrP6FNuoG8\">Default Note Title</a>&nbsp;for creating title templates. A <code>#titleTemplate</code> on a template note is passed on to its instances like any other label, so it names the children of each instance rather than the instances themselves; to name the instances, use <code>#template:titleTemplate</code>.</p>",
"_help_B2ORr7OVEZtc": "<p>Snippets let you define reusable pieces of text, Markdown or code that can be quickly inserted into your notes.</p>",
"_help_VQjhl61rlWh9": "<p>Markdown Snippets are closely related to&nbsp;<a class=\"reference-link\" href=\"#root/_help_KC1HB96bqqHX\">Templates</a>, but instead of defining the content of an entire note, a snippet is a reusable piece of Markdown text that can easily be inserted into a&nbsp;<a class=\"reference-link\" href=\"#root/_help_6RM1Q7ppFVoj\">Markdown</a>&nbsp;note.</p><h2>Creating a Markdown snippet</h2><p>In the&nbsp;<a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>: </p><ol><li>Right-click the note where you want to place the snippet.</li><li>Select <em>Insert child note</em>.</li><li>Select <em>More</em> → <em>Markdown snippet</em>.</li></ol><p>Then simply type the desired content into the note.</p><p>The note's title becomes the title of the snippet. Optionally, you can add a description in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_OFXdgB2nNk1F\">Promoted Attributes</a>&nbsp;section.</p><h2>Inserting a snippet</h2><p>To insert a snippet, type <code>/snippet</code> and select its title from the dropdown.</p><p><a class=\"reference-link\" href=\"#root/_help_IEgsWp5hHH35\">Code Snippets</a>&nbsp;with their language mode set to \"Plain text\" are also listed here.</p><h2>Limitations</h2><ul><li>Unlike&nbsp;<a class=\"reference-link\" href=\"#root/_help_KC1HB96bqqHX\">Templates</a>, snippets cannot be limited to a particular <a href=\"#root/_help_9sRHySam5fXb\">workspace</a>.</li></ul>",
"_help_IEgsWp5hHH35": "<p>Code Snippets are closely related to&nbsp;<a class=\"reference-link\" href=\"#root/_help_KC1HB96bqqHX\">Templates</a>, but instead of defining the content of an entire note, a snippet is a reusable piece of code that can easily be inserted into a&nbsp;<a class=\"reference-link\" href=\"#root/_help_6f9hih2hXXZk\">Code</a>&nbsp;note.</p><h2>Creating a Code snippet</h2><p>In the&nbsp;<a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>: </p><ol><li>Right-click the note where you want to place the snippet.</li><li>Select <em>Insert child note</em>.</li><li>Select <em>More</em> → <em>Code snippet</em>.</li></ol><p>Then simply type the desired code into the note and set the correct language mode.</p><p>The note's title becomes the title of the snippet. Optionally, you can add a description in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_OFXdgB2nNk1F\">Promoted Attributes</a>&nbsp;section.</p><h2>Inserting a snippet</h2><p>To insert a snippet, type <code>/snippet</code> and select its title from the dropdown.</p><aside class=\"admonition important\"><p>Only code snippets whose language mode matches the current code note are listed. For example, a CSS code note shows only CSS snippets, not JavaScript ones. The exception is snippets set to \"Plain text\", which are available in&nbsp;<a class=\"reference-link\" href=\"#root/_help_6RM1Q7ppFVoj\">Markdown</a>&nbsp;notes and any code note regardless of its language mode.</p></aside><h2>Limitations</h2><ul><li>Unlike&nbsp;<a class=\"reference-link\" href=\"#root/_help_KC1HB96bqqHX\">Templates</a>, snippets cannot be limited to a particular <a href=\"#root/_help_9sRHySam5fXb\">workspace</a>.</li></ul>",
@@ -220,7 +220,7 @@
"_help_J5Ex1ZrMbyJ6": "<p>Trilium provides a mechanism for <a href=\"#root/_help_CdNpE2pqjmI6\">scripts</a> to open a public REST endpoint. This opens a way for various integrations with other services - a simple example would be creating new note from Slack by issuing a slash command (e.g. <code>/trilium buy milk</code>).</p><h2>Create note from outside Trilium</h2><p>Let's take a look at an example. The goal is to provide a REST endpoint to which we can send title and content and Trilium will create a note.</p><p>We'll start with creating a JavaScript backend <a href=\"#root/_help_6f9hih2hXXZk\">code note</a> containing:</p><pre><code class=\"language-text-x-trilium-auto\">const {req, res} = api;\nconst {secret, title, content} = req.body;\n\nif (req.method == 'POST' &amp;&amp; secret === 'secret-password') {\n // notes must be saved somewhere in the tree hierarchy specified by a parent note. \n // This is defined by a relation from this code note to the \"target\" parent note\n // alternatively you can just use constant noteId for simplicity (get that from \"Note Info\" dialog of the desired parent note)\n const targetParentNoteId = api.currentNote.getRelationValue('targetNote');\n \n const {note} = api.createTextNote(targetParentNoteId, title, content);\n const notePojo = note.getPojo();\n\n res.status(201).json(notePojo);\n}\nelse {\n res.send(400);\n}</code></pre><p>This script note has also following two attributes:</p><ul><li>label <code>#customRequestHandler</code> with value <code>create-note</code></li><li>relation <code>~targetNote</code> pointing to a note where new notes should be saved</li></ul><h3>Explanation</h3><p>Let's test this by using an HTTP client to send a request:</p><pre><code class=\"language-text-x-trilium-auto\">POST http://your-trilium-server/custom/create-note\nContent-Type: application/json\n\n{\n \"secret\": \"secret-password\",\n \"title\": \"hello\",\n \"content\": \"world\"\n}+++++++++++++++++++++++++++++++++++++++++++++++</code></pre><p>Notice the <code>/custom</code> part in the request path - Trilium considers any request with this prefix as \"custom\" and tries to find a matching handler by looking at all notes which have <code>customRequestHandler</code> <a href=\"#root/_help_zEY4DaJG4YT5\">label</a>. Value of this label then contains a regular expression which will match the request path (in our case trivial regex \"create-note\").</p><p>Trilium will then find our code note created above and execute it. <code>api.req</code>, <code>api.res</code> are set to <a href=\"https://expressjs.com/en/api.html#req\">request</a> and <a href=\"https://expressjs.com/en/api.html#res\">response</a>objects from which we can get details of the request and also respond.</p><p>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.</p><p>Once we pass these checks we will just create the desired note using <a href=\"#root/_help_GLks18SNjxmC\">Script API</a>.</p><h2>Custom resource provider</h2><p>Another common use case is that you want to just expose a file note - in such case you create label <code>customResourceProvider</code> (value is again path regex).</p><p>For more information, see&nbsp;<a href=\"#root/_help_d3fAXQ2diepH\">Custom Resource Providers</a>.</p><h2>Advanced concepts</h2><p><code>api.req</code> and <code>api.res</code> are Express.js objects - you can always look into its <a href=\"https://expressjs.com/en/api.html\">documentation</a> for details.</p><h3>Parameters</h3><p>REST request paths often contain parameters in the URL, e.g.:</p><pre><code class=\"language-text-x-trilium-auto\">http://your-trilium-server/custom/notes/123</code></pre><p>The last part is dynamic so the matching of the URL must also be dynamic - for this reason the matching is done with regular expressions. Following <code>customRequestHandler</code> value would match it:</p><pre><code class=\"language-text-x-trilium-auto\">notes/([0-9]+)</code></pre><p>Additionally, this also defines a matching group with the use of parenthesis which then makes it easier to extract the value. The matched groups are available in <code>api.pathParams</code>:</p><pre><code class=\"language-text-x-trilium-auto\">const noteId = api.pathParams[0];</code></pre><p>Often you also need query params (as in e.g. <code>http://your-trilium-server/custom/notes?noteId=123</code>), you can get those with standard express <code>req.query.noteId</code>.</p>",
"_help_d3fAXQ2diepH": "<p>A custom resource provider allows any file imported into Trilium (images, fonts, stylesheets) to be publicly accessible via a URL.</p><p>A potential use case for this is to add embed a custom font alongside a theme.</p><h2>Steps for creating a custom resource provider</h2><ol><li>Import a file such as an image or a font into Trilium by drag &amp; drop.</li><li>Set the <a href=\"#root/_help_HI6GBBIduIgv\">label</a> <code>#customResourceProvider</code> to <code>hello</code>.</li><li>To test if it is working, use a browser to navigate to <code>&lt;protocol&gt;://&lt;host&gt;/custom/hello</code> (where <code>&lt;protocol&gt;</code> is either <code>http</code> or <code>https</code> based on your setup, and <code>&lt;host&gt;</code> is the host or IP to your Trilium server instance). If you are running the TriliumNext application without a server, use <code>http://localhost:37840</code> as the base URL.</li><li>If everything went well, at the previous step the browser should have downloaded the file uploaded in the first step.</li></ol><p>Instead of <code>hello</code>, the name can be:</p><ul><li>A path, such as <code>fonts/Roboto.ttf</code>, which would be accessible via <code>&lt;host&gt;/custom/fonts/Roboto.ttf</code>.</li><li>As a more advanced use case, a regular expression to match multiple routes, such as <code>hello/.*</code> which will be accessible via <code>/custom/hello/1</code>, <code>/custom/hello/2</code>, <code>/custom/hello/world</code>, etc.</li></ul><h2>Using it in a theme</h2><p>For example, if you have a custom font to be imported by the theme, first upload a font file into Trilium and assign it the <code>#customResourceProvider=fonts/myfont.ttf</code> attribute.</p><p>Then modify the theme CSS to point to:</p><pre><code class=\"language-text-css\">@font-face {\n\tfont-family: customFont;\n\tsrc: url(\"/custom/fonts/myfont.ttf\");\n}\n\ndiv {\n\tfont-family: customFont;\n}</code></pre>",
"_help_pgxEVkzLl1OP": "<aside class=\"admonition tip\"><p>For a quick start, consult the&nbsp;<a class=\"reference-link\" href=\"{{helpAssets}}/User%20Guide/Advanced%20Usage/ETAPI%20(REST%20API)/API%20Reference.dat\">API Reference</a>.</p></aside><p>ETAPI is Trilium's public/external REST API. It is available since Trilium v0.50.</p><h2>API clients</h2><p>As an alternative to calling the API directly, there are client libraries to simplify this</p><ul><li><a href=\"https://github.com/Nriver/trilium-py\">trilium-py</a>, you can use Python to communicate with Trilium.</li></ul><h2>Obtaining a token</h2><p>All operations with the REST API have to be authenticated using a token. You can get this token either from Options -&gt; ETAPI or programmatically using the <code>/auth/login</code> REST call (see the <a href=\"https://github.com/TriliumNext/Trilium/blob/master/src/etapi/etapi.openapi.yaml\">spec</a>).</p><h2>Authentication</h2><h3>Via the <code>Authorization</code> header</h3><pre><code class=\"language-text-x-trilium-auto\">GET https://myserver.com/etapi/app-info\nAuthorization: ETAPITOKEN</code></pre><p>where <code>ETAPITOKEN</code> is the token obtained in the previous step.</p><p>For compatibility with various tools, it's also possible to specify the value of the <code>Authorization</code> header in the format <code>Bearer ETAPITOKEN</code> (since 0.93.0).</p><h3>Basic authentication</h3><p>Since v0.56 you can also use basic auth format:</p><pre><code class=\"language-text-x-trilium-auto\">GET https://myserver.com/etapi/app-info\nAuthorization: Basic BATOKEN</code></pre><ul><li>Where <code>BATOKEN = BASE64(username + ':' + password)</code> - this is a standard Basic Auth serialization</li><li>Where <code>username</code> is \"etapi\"</li><li>And <code>password</code> is the generated ETAPI token described above.</li></ul><p>Basic Auth is meant to be used with tools which support only basic auth.</p><h2>Interaction using Bash scripts</h2><p>It is possible to write simple Bash scripts to interact with Trilium. As an example, here's how to obtain the HTML content of a note:</p><pre><code class=\"language-text-x-trilium-auto\">#!/usr/bin/env bash\n\n# Configuration\nTOKEN=z1vA4fkGxjOR_ZXLrZeqHEFOv65yV3882iFCRtNIK9k9iWrHliITNSLQ=\nSERVER=http://localhost:8080\n\n# Download a note by ID\nNOTE_ID=\"i6ra4ZshJhgN\"\ncurl \"$SERVER/etapi/notes/$NOTE_ID/content\" -H \"Authorization: $TOKEN\" </code></pre><p>Make sure to replace the values of:</p><ul><li><code>TOKEN</code> with your ETAPI token.</li><li><code>SERVER</code> with the correct protocol, host name and port to your Trilium instance.</li><li><code>NOTE_ID</code> with an existing note ID to download.</li></ul><p>As another example, to obtain a .zip export of a note and place it in a directory called <code>out</code>, simply replace the last statement in the script with:</p><pre><code class=\"language-text-x-trilium-auto\">curl -H \"Authorization: $TOKEN\" \\\n\t-X GET \"$SERVER/etapi/notes/$NOTE_ID/export\" \\\n --output \"out/$NOTE_ID.zip\"</code></pre><h2>Uploading binary content</h2><p>A JSON request body can only carry text, so the <code>content</code> field of <code>POST /etapi/attachments</code> stores exactly the string it receives. To upload an image, a PDF or any other binary file, send the raw bytes to the content endpoint with the <code>application/octet-stream</code> content type. The same applies to the content of a note (<code>PUT /etapi/notes/{noteId}/content</code>).</p><p>To attach a file to a note, create the attachment without content, then upload the file to it:</p><pre><code class=\"language-text-x-trilium-auto\">ATTACHMENT_ID=$(curl -s -X POST \"$SERVER/etapi/attachments\" \\\n -H \"Authorization: $TOKEN\" \\\n -H \"Content-Type: application/json\" \\\n -d \"{\\\"ownerId\\\": \\\"$NOTE_ID\\\", \\\"role\\\": \\\"file\\\", \\\"mime\\\": \\\"application/pdf\\\", \\\"title\\\": \\\"report.pdf\\\", \\\"position\\\": 10}\" \\\n | jq -r .attachmentId)\n\ncurl -X PUT \"$SERVER/etapi/attachments/$ATTACHMENT_ID/content\" \\\n -H \"Authorization: $TOKEN\" \\\n -H \"Content-Type: application/octet-stream\" \\\n --data-binary @report.pdf</code></pre><p>Use <code>--data-binary</code> rather than <code>-d</code>, which strips line breaks from the file. For an image, set <code>role</code> to <code>image</code> and <code>mime</code> to the image's type, such as <code>image/png</code>.</p>",
- "_help_47ZrP6FNuoG8": "<p>When a new note is created, its name is by default \"new note\". In some cases, it can be desirable to have a different or even a dynamic default note title.</p><p>For this use case, Trilium (since v0.52) supports <code>#titleTemplate</code> <a href=\"#root/_help_zEY4DaJG4YT5\">label</a>. You can create such a label for a given note, assign it a value, and this value will be used as a default title when creating child notes. As with other labels, you can make it inheritable to apply recursively, and you can even place it on the root note to have it applied globally everywhere.</p><p>As an example use case, imagine you collect books you've read in a given year like this:</p><ul><li>2022 Books<ul><li>Neal Stephenson: Anathem, 2008</li><li>Franz Kafka: Die Verwandlung, 1915</li></ul></li></ul><p>Now, to the parent note \"2022 Books\" you can assign label <code>#titleTemplate=\"[Author name]: [Book title], [Publication year]\"</code>.</p><p>And all children of \"2022 Books\" will be created with initial title \"[Author name]: [Book title], [Publication year]\". There's no artificial intelligence here, the idea is to just prompt you to manually fill in the pieces of information into the note title by yourself.</p><h2>Dynamic value</h2><p>The value of <code>#titleTemplate</code> 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.</p><p>Second variable injected is <code>parentNote</code> which gives access to the parent <a href=\"{{helpAssets}}/User%20Guide/Scripting/Script%20API/Frontend%20API/FNote.dat\"><code>FNote</code></a>.</p><p>See also&nbsp;<a class=\"reference-link\" href=\"#root/_help_KC1HB96bqqHX\">Templates</a>&nbsp;which provides similar capabilities, including default note's content.</p><h3>Examples</h3><ul><li>Imagine you collect server outage incidents and write some notes. It looks like this:<ul><li>Incidents<ul><li>2022-05-09: System crash</li><li>2022-05-15: Backup delay</li></ul></li><li>You can automatize the date assignment by assigning a label <code>#titleTemplate=\"${now.format('YYYY-MM-DD')}: \"</code> to the parent note \"Incidents\". Whenever a new child note is created, the title template is evaluated with the injected <a href=\"https://day.js.org/docs/en/display/format\">now</a> object.</li></ul></li><li>To use a parent's attribute in the title of new notes: <code>#titleTemplate=\"${parentNote.getLabelValue('authorName')}'s literary works\"</code></li><li>To mirror the parent's note title: <code>${parentNote.title}</code></li></ul>",
+ "_help_47ZrP6FNuoG8": "<p>When a new note is created, its name is by default \"new note\". In some cases, it can be desirable to have a different or even a dynamic default note title.</p><p>For this use case, Trilium (since v0.52) supports <code>#titleTemplate</code> <a href=\"#root/_help_zEY4DaJG4YT5\">label</a>. You can create such a label for a given note, assign it a value, and this value will be used as a default title when creating child notes. As with other labels, you can make it inheritable to apply recursively, and you can even place it on the root note to have it applied globally everywhere.</p><p>As an example use case, imagine you collect books you've read in a given year like this:</p><ul><li>2022 Books<ul><li>Neal Stephenson: Anathem, 2008</li><li>Franz Kafka: Die Verwandlung, 1915</li></ul></li></ul><p>Now, to the parent note \"2022 Books\" you can assign label <code>#titleTemplate=\"[Author name]: [Book title], [Publication year]\"</code>.</p><p>And all children of \"2022 Books\" will be created with initial title \"[Author name]: [Book title], [Publication year]\". There's no artificial intelligence here, the idea is to just prompt you to manually fill in the pieces of information into the note title by yourself.</p><h2>Titles set by a template</h2><p>A template can name the notes created from it, wherever they are created. To do so, add a <code>#template:titleTemplate</code> label to the template note, for example <code>#template:titleTemplate=\"Meeting ${now.format('YYYY-MM-DD')}\"</code> on a <em>Meeting</em> template.</p><ul><li>It applies both when the template is picked explicitly and when it comes from a parent's <code>~child:template</code>. See <a class=\"reference-link\" href=\"#root/_help_KC1HB96bqqHX\">Templates</a>.</li><li>It takes precedence over the parent's <code>#titleTemplate</code>. A title typed in by the user always wins.</li><li>It can be inherited from the template's ancestors in the tree (for example, a folder holding several templates), in which case a label owned by the template itself takes precedence. A note created from a template and later marked as a template does not keep that template's title.</li><li>Its value is evaluated the same way as <code>#titleTemplate</code>, with <code>parentNote</code> being the parent of the new note.</li></ul><h2>Dynamic value</h2><p>The value of <code>#titleTemplate</code> 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.</p><p>Second variable injected is <code>parentNote</code> which gives access to the parent <a href=\"{{helpAssets}}/User%20Guide/Scripting/Script%20API/Frontend%20API/FNote.dat\"><code>FNote</code></a>.</p><p>See also&nbsp;<a class=\"reference-link\" href=\"#root/_help_KC1HB96bqqHX\">Templates</a>&nbsp;which provides similar capabilities, including default note's content.</p><h3>Examples</h3><ul><li>Imagine you collect server outage incidents and write some notes. It looks like this:<ul><li>Incidents<ul><li>2022-05-09: System crash</li><li>2022-05-15: Backup delay</li></ul></li><li>You can automatize the date assignment by assigning a label <code>#titleTemplate=\"${now.format('YYYY-MM-DD')}: \"</code> to the parent note \"Incidents\". Whenever a new child note is created, the title template is evaluated with the injected <a href=\"https://day.js.org/docs/en/display/format\">now</a> object.</li></ul></li><li>To use a parent's attribute in the title of new notes: <code>#titleTemplate=\"${parentNote.getLabelValue('authorName')}'s literary works\"</code></li><li>To mirror the parent's note title: <code>${parentNote.title}</code></li></ul>",
"_help_wX4HbRucYSDD": "<p>Your Trilium data is stored in a <a href=\"https://www.sqlite.org\">SQLite</a> database which contains all notes, tree structure, metadata, and most of the configuration. The database file is named <code>document.db</code> and is stored in the application's default&nbsp;<a href=\"#root/_help_tAassRL4RSQL\">Data directory</a>.</p><h2>Demo Notes</h2><p>When first starting Trilium, it will provide a set of notes to showcase various features of the application.</p><p>For more information see&nbsp;<a class=\"reference-link\" href=\"#root/_help_6tZeKvSHEUiB\">Demo Notes</a>.</p><h2>Manually Modifying the Database</h2><p>Trilium provides a lot of flexibility, and with it, opportunities for advanced users to tweak it. If you need to explore or modify the database directly, you can use a tool such as <a href=\"https://sqlitebrowser.org/\">SQLite Browser</a> to work directly on the database file.</p><p>See&nbsp;<a href=\"#root/_help_oyIAJ9PvvwHX\">Manually altering the database</a>&nbsp;for more information.</p><h2>How to Reset the Database</h2><p>If you want to start again and:</p><ul><li>Create and switch to a new blank knowledge base</li><li>Use a different knowledge base synced from a server or desktop application</li><li>Restore a backup</li></ul><p>You can navigate to&nbsp;<a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Database</em> and click the <em>Start over</em> button. You'll be prompted to restart the application, with the option to back up your current database before proceeding.</p><aside class=\"admonition important\"><p>For the web client, Trilium cannot restart automatically. You'll need to manually restart the server/container and then reload the web application.</p></aside><p>After restarting, the setup screen will appear. You can choose to back up your existing database, then proceed with the setup menu as if it's a new installation. The existing database will only be overwritten after selecting to create a new database, sync with a server, or restore from a backup.</p><h3>The Legacy Method</h3><p>If you are experimenting with Trilium and want to return it to its original state, you can do that by deleting the current database. When you restart the application, it will generate a new database containing the original demo notes.</p><p>To delete the database, simply go to the <a href=\"#root/_help_tAassRL4RSQL\">data directory</a> and delete the <code>document.db</code> file (and any other files starting with <code>document.db</code>).</p><p>If you do not need to preserve any configurations that might be stored in the <code>config.ini</code> file, you can just delete all of the <a href=\"#root/_help_tAassRL4RSQL\">data directory's</a> contents to fully restore the application to its original state. You can also review the <a href=\"#root/_help_Gzjqa934BdH4\">configuration</a> file to provide all <code>config.ini</code> values as environment variables instead.</p>",
"_help_oyIAJ9PvvwHX": "<p>There are some situations where modifying the SQLite database that Trilium uses is desirable.</p><p>If you are doing any advanced development or troubleshooting where you manually modify the database, you might want to consider creating backups of your <code>document.db</code> file.</p><h2>Modifying it internally using the SQL Console</h2><p>The SQL Console is Trilium's built-in database editor.</p><p>See&nbsp;<a class=\"reference-link\" href=\"#root/_help_YKWqdJhzi2VY\">SQL Console</a>.</p><h2>Externally modifying the database</h2><p>Sometimes the SQL Console cannot be used (for example if the application cannot start).</p><p>When making external modifications, consider closing the desktop application. If modifying the server database, then stop the service or Docker container.</p><h3>Using DB Browser for SQLite</h3><p>DB Browser for SQLite is a cross-platform editor that can be used to alter the database using a graphical user interface.</p><p>To do so:</p><ol><li>In the main menu, select File → Open database… and navigate to the database in the&nbsp;<a href=\"#root/_help_tAassRL4RSQL\">Data directory</a>.</li><li>Select the <em>Execute SQL</em> tab.</li><li>Type in the desired SQL statement.</li><li>Press the \"Play\" button in the toolbar underneath the \"Execute SQL\" tab (or F5 key).</li><li>Press \"Write Changes\" in the main toolbar.</li><li>Close the application or close the database.</li></ol><p><img src=\"{{helpAssets}}/User%20Guide/Advanced%20Usage/Database/Manually%20altering%20the%20database_image.jpg\"></p><h3>Using the SQLite CLI</h3><p>First, start the SQLite 3 CLI by specifying the path to the database:</p><pre><code class=\"language-text-x-trilium-auto\">sqlite3 ~/.local/share/trilium-data/document.db</code></pre><ul><li>In the prompt simply type the statement and make sure it ends with a <code>;</code> character.</li><li>To exit, simply type <code>.quit</code> and enter.</li></ul>",
"_help_YKWqdJhzi2VY": "<aside class=\"admonition important\"><p>Starting with v0.104.0, backend scripts are disabled by default to reduce the attack surface. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_fiHicjpHjIRJ\">Security</a>&nbsp;for more information.</p></aside><p>The SQL Console is Trilium's built-in database editor.</p><p>It can be accessed by going to the&nbsp;<a class=\"reference-link\" href=\"#root/_help_x3i7MxGccDuM\">Global menu</a>&nbsp;→ Advanced → Open SQL Console.</p><p><img src=\"{{helpAssets}}/User%20Guide/Advanced%20Usage/Database/Manually%20altering%20the%20database/SQL%20Console_image.jpg\"></p><h3>Interaction</h3><ul><li>Hovering the mouse over one of the tables listed at the top of the document will show the columns and their data type.</li><li>Only one SQL statement can be run at once.</li><li>To run the statement, press the <em>Execute</em> icon.</li><li>For queries that return a result, the data will displayed in a table.</li><li>For statements (e.g. <code>INSERT</code>, <code>UPDATE</code>), the number of affected rows is displayed.</li></ul><figure class=\"image\"><img style=\"aspect-ratio:1124/571;\" src=\"{{helpAssets}}/User%20Guide/Advanced%20Usage/Database/Manually%20altering%20the%20database/SQL%20Console_image.png\" width=\"1124\" height=\"571\"></figure><h3>Interacting with the table</h3><p>After executing a query, a table with the results will be displayed:</p><ul><li>Clicking on a column allows sorting ascending or descending.</li><li>Underneath each column there is an input field which allows filtering by text.</li><li>Press <kbd>Ctrl</kbd>+<kbd>C</kbd> to copy the current cell to clipboard.</li><li>Multiple cells can be selected by dragging or by holding <kbd>Shift</kbd> + arrow keys</li><li>Results are paginated for performance reasons. The controls at the bottom of the table can be used to navigate through pages.</li></ul><h3>Saved SQL console</h3><p>SQL queries or commands can be saved into a dedicated note.</p><p>To do so, simply write the query and press the&nbsp;<span class=\"tn-icon bx bx-save\"></span> button. Once saved, the note will appear in&nbsp;<a class=\"reference-link\" href=\"#root/_help_l0tKav7yLHGF\">Day Notes</a>&nbsp;by default. It is possible to change the default location of saved queries by assigning a <code>#sqlConsoleHome</code> <a href=\"#root/_help_HI6GBBIduIgv\">label</a>.</p><p>The note can be locked for editing by pressing the <em>Lock</em> button in the note actions section near the title bar. When editing is locked, the SQL statement is hidden from view.</p>",
diff --git a/docs/User Guide/User Guide/Advanced Usage/Attributes/Labels.md b/docs/User Guide/User Guide/Advanced Usage/Attributes/Labels.md
index 1f6e9187f2..135be11290 100644
--- a/docs/User Guide/User Guide/Advanced Usage/Attributes/Labels.md
+++ b/docs/User Guide/User Guide/Advanced Usage/Attributes/Labels.md
@@ -71,6 +71,7 @@ This is a list of labels that Trilium natively supports.
| `share*` | See the attribute reference in <a class="reference-link" href="../Sharing.md">Sharing</a>. |
| `displayRelations`, `hideRelations` | Comma delimited names of relations which should be displayed/hidden in a <a class="reference-link" href="../../Note%20Types/Relation%20Map.md">Relation Map</a> (both the note type and the <a class="reference-link" href="../Note%20Map%20(Link%20map%2C%20Tree%20map).md">Note Map (Link map, Tree map)</a> general functionality). |
| `titleTemplate` | Default title of notes created as children of this note. This value is evaluated as a JavaScript string and thus can be enriched with dynamic content via the injected `now` and `parentNote` variables.       <br> <br>See <a class="reference-link" href="../Default%20Note%20Title.md">Default Note Title</a> for more info. |
+| `template:titleTemplate` | Set on a template note: default title of notes created from the template, taking precedence over the parent's `titleTemplate`. Evaluated the same way as `titleTemplate`. See <a class="reference-link" href="../Default%20Note%20Title.md">Default Note Title</a>. |
| `template` | This note will appear in the selection of available template when creating new note. See <a class="reference-link" href="../Templates.md">Templates</a> for more information. |
| `color` | defines color of the note in note tree, links etc. Use any valid CSS color value like 'red' or #a13d5f        <br>Note: this color may be automatically adjusted when displayed to ensure sufficient contrast with the background. |
| `keyboardShortcut` | Defines a keyboard shortcut which will immediately jump to this note. Example: 'ctrl+alt+e'. Requires frontend reload for the change to take effect. |
diff --git a/docs/User Guide/User Guide/Advanced Usage/Default Note Title.md b/docs/User Guide/User Guide/Advanced Usage/Default Note Title.md
index 3ee4676721..678c594de9 100644
--- a/docs/User Guide/User Guide/Advanced Usage/Default Note Title.md
+++ b/docs/User Guide/User Guide/Advanced Usage/Default Note Title.md
@@ -13,6 +13,15 @@ Now, to the parent note "2022 Books" you can assign label `#titleTemplate="[Auth
And all children of "2022 Books" will be created with initial title "\[Author name\]: \[Book title\], \[Publication year\]". There's no artificial intelligence here, the idea is to just prompt you to manually fill in the pieces of information into the note title by yourself.
+## Titles set by a template
+
+A template can name the notes created from it, wherever they are created. To do so, add a `#template:titleTemplate` label to the template note, for example `#template:titleTemplate="Meeting ${now.format('YYYY-MM-DD')}"` on a _Meeting_ template.
+
+* It applies both when the template is picked explicitly and when it comes from a parent's `~child:template`. See <a class="reference-link" href="Templates.md">Templates</a>.
+* It takes precedence over the parent's `#titleTemplate`. A title typed in by the user always wins.
+* It can be inherited from the template's ancestors in the tree (for example, a folder holding several templates), in which case a label owned by the template itself takes precedence. A note created from a template and later marked as a template does not keep that template's title.
+* Its value is evaluated the same way as `#titleTemplate`, with `parentNote` being the parent of the new note.
+
## Dynamic value
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.
diff --git a/docs/User Guide/User Guide/Advanced Usage/Templates.md b/docs/User Guide/User Guide/Advanced Usage/Templates.md
index 5bb2313671..127d4a1983 100644
--- a/docs/User Guide/User Guide/Advanced Usage/Templates.md
+++ b/docs/User Guide/User Guide/Advanced Usage/Templates.md
@@ -59,10 +59,14 @@ By default, newly created notes are <a class="reference-link" href="../Note%20T
Selecting a specific template from the creation menu always takes precedence over `child:template`.
+## Default title for new notes
+
+A template can also give its instances a default title, using the `#template:titleTemplate` label. See <a class="reference-link" href="Default%20Note%20Title.md">Default Note Title</a> for details.
+
## Additional Notes
From a visual perspective, templates can define `#iconClass` and `#cssClass` attributes, allowing all instance notes (e.g., books) to display a specific icon and CSS style.
Explore the concept further in the <a class="reference-link" href="Database/Demo%20Notes.md">Demo Notes</a>, including examples like the <a class="reference-link" href="../Note%20Types/Relation%20Map.md">Relation Map</a>, <a class="reference-link" href="Advanced%20Showcases/Task%20Manager.md">Task Manager</a>, and <a class="reference-link" href="Advanced%20Showcases/Day%20Notes.md">Day Notes</a>.
-Additionally, see <a class="reference-link" href="Default%20Note%20Title.md">Default Note Title</a> for creating title templates. Note templates and title templates can be combined by creating a `#titleTemplate` for a template note.
\ No newline at end of file
+Additionally, see <a class="reference-link" href="Default%20Note%20Title.md">Default Note Title</a> for creating title templates. A `#titleTemplate` on a template note is passed on to its instances like any other label, so it names the children of each instance rather than the instances themselves; to name the instances, use `#template:titleTemplate`.
\ No newline at end of file
diff --git a/packages/commons/src/lib/builtin_attributes.ts b/packages/commons/src/lib/builtin_attributes.ts
index c84440d75f..0a8a0bd691 100644
--- a/packages/commons/src/lib/builtin_attributes.ts
+++ b/packages/commons/src/lib/builtin_attributes.ts
@@ -192,6 +192,8 @@ const BUILTIN_ATTRIBUTES = [
{ type: "label", name: "displayRelations", valueType: "text" },
{ type: "label", name: "hideRelations", valueType: "text" },
{ type: "label", name: "titleTemplate", valueType: "text", isDangerous: true },
+ // Set on a template: the default title of a note created from it, as `#titleTemplate` is for children.
+ { type: "label", name: "template:titleTemplate", valueType: "text", isDangerous: true },
{ type: "label", name: "template", valueType: "boolean" },
{ type: "label", name: "snippet", valueType: "boolean" },
{ type: "label", name: "snippetDescription", valueType: "text", hasUserValue: true },
diff --git a/packages/trilium-core/src/services/notes.spec.ts b/packages/trilium-core/src/services/notes.spec.ts
index 2b00bcbfa6..529a46c000 100644
--- a/packages/trilium-core/src/services/notes.spec.ts
+++ b/packages/trilium-core/src/services/notes.spec.ts
@@ -351,6 +351,39 @@ describe("notes service (real DB)", () => {
expect(note.mime).toBe("text/x-python");
expect(note.getContent()).toBe("print('hi')");
});
+
+ it("titles a note from its template's #template:titleTemplate before the parent's #titleTemplate", () => {
+ const templates = createNote("root", {
+ attributes: [
+ { type: "label", name: "template:titleTemplate", value: "Folder ${parentNote.title}", isInheritable: true }
+ ]
+ });
+ const meeting = createNote(templates.note.noteId, {
+ attributes: [{ type: "label", name: "template:titleTemplate", value: "Meeting ${parentNote.title}" }]
+ });
+ const book = createNote(templates.note.noteId);
+ const plain = createNote("root");
+ const parent = createNote("root", {
+ title: "Q4",
+ attributes: [
+ { type: "label", name: "titleTemplate", value: "Child of ${parentNote.title}" },
+ { type: "relation", name: "child:template", value: meeting.note.noteId }
+ ]
+ });
+ const untitled = (templateNoteId?: string, title?: string) => createNote(parent.note.noteId, {
+ title, templateNoteId
+ }).note;
+
+ expect(untitled(undefined).title).toBe("Meeting Q4");
+ expect(untitled(book.note.noteId).title).toBe("Folder Q4");
+ expect(untitled(plain.note.noteId).title).toBe("Child of Q4");
+ expect(untitled(meeting.note.noteId, "Typed").title).toBe("Typed");
+
+ // A note created from Meeting and marked #template does not take Meeting's title along.
+ const instance = untitled(meeting.note.noteId);
+ getContext().init(() => instance.setLabel("template"));
+ expect(untitled(instance.noteId).title).toBe("Child of Q4");
+ });
});
describe("createNewNote logging", () => {
diff --git a/packages/trilium-core/src/services/notes.ts b/packages/trilium-core/src/services/notes.ts
index 6758362cce..ff13ed8f88 100644
--- a/packages/trilium-core/src/services/notes.ts
+++ b/packages/trilium-core/src/services/notes.ts
@@ -161,9 +161,48 @@ function copyAttachments(origNote: BNote, newNote: BNote) {
}
function getNewNoteTitle(parentNote: BNote) {
- let title = t("notes.new-note");
+ return evaluateTitleTemplate(
+ parentNote.getLabelValue("titleTemplate"),
+ parentNote,
+ `titleTemplate of note '${parentNote.noteId}'`
+ );
+}
+
+/**
+ * Returns the default title that the first of the note's templates carrying a
+ * `#template:titleTemplate` gives it, or `null` when none does.
+ */
+function getTemplateNoteTitle(note: BNote, parentNote: BNote) {
+ for (const relation of note.getOwnedRelations("template")) {
+ const templateNote = relation.targetNote;
+ const titleTemplate = templateNote ? getTemplateTitleTemplate(templateNote) : null;
+
+ if (templateNote && titleTemplate !== null) {
+ return evaluateTitleTemplate(
+ titleTemplate,
+ parentNote,
+ `template:titleTemplate of note '${templateNote.noteId}'`
+ );
+ }
+ }
- const titleTemplate = parentNote.getLabelValue("titleTemplate");
+ return null;
+}
+
+/**
+ * Reads the template's own `#template:titleTemplate`, or one inherited from its ancestors in the tree.
+ * A value lent through `~template` is skipped, so a note created from a template and later marked
+ * `#template` does not adopt the original template's title, as with `~template:newNoteDefaultParent`.
+ */
+function getTemplateTitleTemplate(templateNote: BNote) {
+ const sourceNoteIds = new Set([ templateNote.noteId, ...templateNote.getAncestorNoteIds() ]);
+
+ return templateNote.getLabels("template:titleTemplate")
+ .find((label) => sourceNoteIds.has(label.noteId))?.value ?? null;
+}
+
+function evaluateTitleTemplate(titleTemplate: string | null, parentNote: BNote, source: string) {
+ let title = t("notes.new-note");
if (titleTemplate !== null) {
const now = dayjs(date_utils.localNowDateTime() || new Date());
@@ -175,7 +214,7 @@ function getNewNoteTitle(parentNote: BNote) {
titleTemplate,
{ now, parentNote },
title,
- `titleTemplate of note '${parentNote.noteId}'`
+ source
);
}
@@ -226,7 +265,8 @@ function createNewNote(params: NoteParams): {
} {
const parentNote = getAndValidateParent(params);
- if (params.title === null || params.title === undefined) {
+ const isTitleDefaulted = params.title === null || params.title === undefined;
+ if (isTitleDefaulted) {
params.title = getNewNoteTitle(parentNote);
}
@@ -336,6 +376,13 @@ function createNewNote(params: NoteParams): {
copyChildAttributes(parentNote, note, params.isTypeDefaulted);
+ // Read once the templates are applied, so both a chosen template and a `child:template` count.
+ const templateTitle = isTitleDefaulted ? getTemplateNoteTitle(note, parentNote) : null;
+ if (templateTitle !== null) {
+ note.title = templateTitle;
+ note.save();
+ }
+
eventService.emit(eventService.ENTITY_CREATED, { entityName: "notes", entity: note });
eventService.emit(eventService.ENTITY_CHANGED, { entityName: "notes", entity: note });
triggerNoteTitleChanged(note);