%% date:: [[2022-11-07]] %% # [[Obsidian Templater]] Obsidian Templater is a [[Obsidian Plugins|plugin]] for [[Obsidian]] that extends upon the Core plugin, confusingly called _Templates_. TemplateR increases the options for creating templates, adds the ability to set default templates per directory, and even runs [[JavaScript|js]] within a vault. <iframe width="560" height="315" src="https://www.youtube.com/embed/W7kTtn9empU?start=478" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> <iframe width="560" height="315" src="https://www.youtube.com/embed/5j9fAvJCaig" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> ## Common Templater functions ### `tp.frontmatter.property` Replace `property` with the name of the parameter in your YAML frontmatter (for example, `type` or `date`). This template, when executed, will be replaced with the value of the specified property. ## Examples of Templater Usage ### Automatically move notes using a certain template to a folder Go into Templater settings and set a Folder Template. For example, set any new note created from a note in `/Meetings/` to automatically use `templates/Person`. In `templates/Person.md`, include the following line: ```js <% await tp.file.move("/People/" + tp.file.title) %> ``` When the template is applied to a note, the note will not only take the `Person` template; it'll also automatically be moved to the `People` folder instead of the `Meetings` one. ### Use suggester When the templates are replaced or applied to a note, you're prompted to select one of the following statuses: ``` <% await tp.system.suggester(["Awaiting Funding", "Not Fulfilled", "Partially Fulfilled", "Fulfilled"], ["Awaiting Funding", "Not Fulfilled", "Partially Fulfilled", "Fulfilled"]) %> ``` ### Get the end date of a month ``` <%* tR += moment().endOf('month').format('YYYY-MM-DD'); %> ```