Overview

Templater is the Obsidian plugin that replaces the built-in Templates core plugin for anything beyond trivial text insertion. It provides JavaScript-style expressions, date arithmetic, file context, and the ability to run user scripts. Use it to inject frontmatter on note creation, auto-fill date fields, and standardize note structure across the vault. Install it before obsidian-plugins covers it in the plugins overview.

Create a base note template with frontmatter

Store templates in _templates/. The base template for a content note:

---
title: "<% tp.file.title %>"
slug: "<% tp.file.title.toLowerCase().replace(/ /g, '-') %>"
category: "<% tp.file.folder(true).split('/')[0] %>"
tags: ["<% tp.file.folder(true).split('/')[0] %>"]
status: "draft"
last_updated: <% tp.date.now("YYYY-MM-DD") %>
summary: ""
related: []
---
 
## Overview
 
## Rules
 
-
 
## Related
 
-

Bind this template to a hotkey in Templater settings. When you create a new note with the hotkey, Templater runs the expressions at creation time rather than insert-time, so tp.file.title captures the actual note name.

Use date macros for time-based fields

Templater exposes tp.date with now, tomorrow, yesterday, and offset arithmetic.

<% tp.date.now("YYYY-MM-DD") %>           // 2026-05-14
<% tp.date.now("YYYY-MM-DD", 7) %>        // 7 days from now
<% tp.date.now("dddd, MMMM D, YYYY") %>   // Thursday, May 14, 2026

For daily note templates, use tp.file.title as the date string (since daily notes are named YYYY-MM-DD):

---
date: <% tp.file.title %>
day: <% tp.date.now("dddd", 0, tp.file.title, "YYYY-MM-DD") %>
---
 
# <% tp.date.now("dddd, MMMM D", 0, tp.file.title, "YYYY-MM-DD") %>
 
## TODOs
 
- [ ]
 
## Notes
 
## Links to process

The second argument to tp.date.now is an offset; the third is the reference date; the fourth is the parse format. This computes the day-of-week from the note title rather than from the current time, so retroactive daily notes get the correct weekday.

Write conditional snippets with JavaScript blocks

Templater’s <%* %> block runs arbitrary JavaScript. Use it for prompts and conditionals:

<%*
const category = await tp.system.prompt("Category?", "coding");
const isPinescript = category === "coding" && tp.file.title.startsWith("pine");
tR += `category: "${category}"\n`;
if (isPinescript) {
    tR += `tags: ["coding", "pine-script", "tradingview"]\n`;
} else {
    tR += `tags: ["${category}"]\n`;
}
%>

tp.system.prompt opens a modal input. tR += appends to the template output. Use these sparingly; a template that asks too many questions slows note creation and creates friction. The goal is to reduce keystrokes, not add them.

Assign templates to folders

In Templater settings, under “Folder Templates,” map each content folder to its template file. When a note is created inside backend/, Templater automatically applies _templates/content-note.md. When a note is created inside daily/, it applies _templates/daily-note.md.

Folder templates eliminate the need to manually invoke a template after note creation. They also enforce schema consistency across the vault; a new note in coding/ will always open with the correct frontmatter stub.

Chain templates for complex note types

For notes that compose multiple templates (a project note that needs frontmatter plus a meeting log section), use tp.file.include:

<% await tp.file.include("[[_templates/frontmatter]]") %>
<% await tp.file.include("[[_templates/meeting-sections]]") %>

Each included template is evaluated in sequence. The included file can itself contain Templater expressions. Keep included fragments focused; a fragment that does one thing is composable.

Trigger templates on file rename

Templater can run a template when a note is first created but before it is renamed. Set “Trigger Templater on new file creation” in Templater settings. Then set “Template folder location” to _templates/. New notes created with Cmd+N or from the Quick Switcher will prompt for the template automatically.

For template updates in existing notes, use Templater: Replace templates in the active file from the Command Palette. It re-evaluates all <% %> expressions in the open note. Use this to update last_updated fields without retyping the date.