Get AI summaries of any video or article — Sign up free
Automate Your Vault With Templater - How to Use Templater in Obsidian thumbnail

Automate Your Vault With Templater - How to Use Templater in Obsidian

FromSergio·
6 min read

Based on FromSergio's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.

TL;DR

Templater’s main advantage over the Template plugin is automation: templates can be applied based on variables like date and folder location.

Briefing

Templater for Obsidian turns static templates into automated, context-aware workflows—at the cost of a longer setup. Instead of manually inserting the same template every time, Templater can generate note content dynamically using variables like the day of the week and where a note was created. Once configured, it becomes a fast way to keep daily notes, weekly planning, and folder-specific documents consistent without repeating the same work.

A key distinction from the Template plugin is automation. The Template plugin mostly provides reusable blocks, while Templater can apply templates based on conditions and parameters. That flexibility is why the setup takes longer: users must learn the syntax and configure when templates trigger. Internally, Templater functions are split into internal functions and user functions; the walkthrough focuses on internal functions, including access to date/time logic and file metadata. (User functions and the Moment object are mentioned as topics for a future, more advanced video.)

The tutorial starts with the core syntax pattern: every Templater function is wrapped between “<%” and “%>” (shown as left arrow percentage and percentage right arrow). A practical friction point appears immediately: after inserting the syntax, results don’t show in preview mode. To apply changes, users must run “Replace templates in the active file” from the command palette—or assign a hotkey to trigger it. The walkthrough recommends setting a hotkey (for example, Option+R) so activation becomes a single keystroke.

For date automation, the most used functions are “tpdate” and “tpfile.” With “tpdate,” users can generate dates in different formats and relative offsets. The examples show how to produce today’s date, yesterday/tomorrow, and dates in the past or future using offsets like “-1m” (one month back), “+2” (two months forward), and “-1y” (one year back). A major upgrade comes when date outputs are turned into links: wrapping the function in square brackets can create clickable references to daily notes for the computed date, assuming those notes exist in the vault.

The walkthrough then uses this to build “on this day” links inside daily notes, so each entry can jump back to the same date from last year. It also adds navigation breadcrumbs for adjacent days (day before/day after) and weekly shortcuts that link to the current week’s Monday. For the weekly link, “tpdate weekday” uses a numeric mapping where 0 represents Monday and other numbers represent subsequent weekdays.

Beyond dates, “tpfile” pulls file-level metadata. It can insert the file’s creation time, last modified time, and the folder path the file currently lives in—useful for templates that adapt to where notes are stored. Another internal function, “tpweb,” can fetch a daily quote (and optionally random images) from the web; the example uses daily quotes to add low-effort variety to journal entries.

Finally, the tutorial shows how to scale this approach across a vault: folder templates apply specific templates automatically to new files created inside designated folders, while hotkeys provide quick access to templates without relying on folder structure. A “default template” hotkey (triggered via Command+M after Command+N) demonstrates how spontaneously created notes can still receive consistent YAML fields like tags, aliases, created/last modified timestamps, and a title prompt. The guide closes by pointing to Templater’s active GitHub community for inspiration, with a warning not to copy snippets blindly without understanding how they fit a vault’s structure.

Cornell Notes

Templater for Obsidian upgrades templates from static text into automated generators that react to context—especially dates, file metadata, and folder location. The workflow relies on Templater’s syntax wrapper (“<% … %>”) and a required activation step (“Replace templates in the active file”), which becomes practical once a hotkey is assigned. Date functions like tpdate can output today/yesterday/tomorrow and compute relative dates using offsets (e.g., -1m, +2, -1y), and those results can be turned into links to jump to existing daily notes. File functions like tpfile can insert creation time, last modified time, and the current folder path, enabling templates that adapt to where notes live. Folder templates and hotkeys help apply the right template automatically across a vault without manual repetition.

Why does Templater feel more powerful than the Template plugin, and what tradeoff comes with that power?

The core difference is automation. Templater can apply templates based on variables such as the day of the week or the folder a note is created in, rather than just inserting a fixed template. That flexibility requires more upfront setup—users must learn the function syntax and configure activation behavior (including hotkeys), but the payoff is that notes can be generated consistently with less manual work.

What’s the practical workflow hurdle when using Templater syntax, and how do hotkeys fix it?

After inserting Templater syntax into a note, preview mode won’t show the computed results. Users must run “Replace templates in the active file” from the command palette to execute the functions. To avoid repeating that step, the tutorial assigns a hotkey (e.g., Option+R) by going to Obsidian hotkeys and binding the Templater replace command, so activation becomes one keystroke.

How can tpdate generate relative dates like “last month” or “two months from now”?

tpdate supports offsets. The examples use today’s date as a baseline (e.g., tpdate now with a YMD format), then add relative adjustments: for last month, add “-1m”; for two months ago, use “-2”; for two months from now, use “+2”. Switching the unit from months to years works similarly by replacing “m” with “y” (e.g., “-1y” for last year).

How does turning a computed date into a link create useful navigation inside daily notes?

Wrapping the tpdate output in square brackets converts it into a link. If the vault has a daily note for that exact computed date, clicking the link jumps to it. The tutorial uses this to build an “on this day” line in daily notes that links to the same calendar date from last year, and it also links to adjacent days (day before/day after) for quick browsing.

What does tpfile add that tpdate can’t, and where does it matter most?

tpfile inserts file-specific metadata rather than calendar logic. It can output the file’s creation date/time, last modified time, and the file’s folder path. This matters when templates need to reflect where a note lives (e.g., a template that behaves differently inside the scripts folder versus elsewhere) or when users want timestamps and provenance fields automatically populated.

How do folder templates and hotkeys work together to scale templating across a vault?

Folder templates apply a designated template automatically to new files created inside specific folders (e.g., a “courses” folder gets a “courses template,” while an “articles” folder can get a different one). Hotkeys provide an alternative for notes that don’t fit a folder structure: each template can be triggered by a shortcut (like Option+P for a people page or Option+M for meetings). The tutorial also demonstrates a default template hotkey (Command+M after Command+N) to ensure spontaneous notes still get consistent YAML fields and a title prompt.

Review Questions

  1. What activation step is required for Templater functions to produce results, and why does preview mode not work?
  2. Give two examples of tpdate offsets (one in months and one in years) and describe what each would output relative to today.
  3. How would you use tpfile to display a note’s current folder, and what would you expect to see when the note is moved into a different folder?

Key Points

  1. 1

    Templater’s main advantage over the Template plugin is automation: templates can be applied based on variables like date and folder location.

  2. 2

    Templater syntax must be executed via “Replace templates in the active file,” so assigning a hotkey is the difference between friction and speed.

  3. 3

    tpdate can generate today’s date and relative dates using offsets such as -1m, +2, and -1y, and it can format dates in cleaner ways.

  4. 4

    Wrapping tpdate output in square brackets turns computed dates into clickable links to existing daily notes.

  5. 5

    tpfile can inject file metadata—creation time, last modified time, and folder path—so templates can adapt to where notes live.

  6. 6

    Folder templates let each folder in a vault automatically receive its own template, reducing manual template selection.

  7. 7

    Hotkeys enable quick template application for notes that don’t belong in a strict folder structure, including a default template for spontaneous notes.

Highlights

Templater turns date math into navigation: computed dates can become links that jump to daily notes for “the same day last year” or adjacent days.
Relative date offsets make templates reusable across time—switching from months to years is as simple as changing the unit (m to y).
File-aware templating is possible with tpfile, which can insert creation time, last modified time, and the current folder path directly into notes.

Topics

  • Templater Syntax
  • Obsidian Hotkeys
  • Date Automation
  • File Metadata
  • Folder Templates

Mentioned

  • Shaquille O'Neal