July 5th, 2021

Using Templater in Obsidian

One of the things that had me struggling with Obsidian early on was it’s lack of iPad support and one of the big pain points there was the way that templates worked in Obsidian. Yes I could use TextExpander, or Alfred Snippets, on macOS to have templates but they wouldn’t transfer to iPadOS. Yes I could use Apple’s built in text replacement features via 1Writer on iPad to have templates.

But those two systems don’t sync so I had to maintain two different copies of templates. At some point they’d fall out of sync, and I’d have to do manual work.

Enter Templater for Obsidian

Templater for Obsidian is pretty much what the name says, a way to super power your templates.

To get started, install it from the Community Plugins and then activate it. You’ll need to choose a folder for your templates. My best advice is to choose a folder called Templates so that it’s obvious where your templates are.

There is far more power behind Templater than I can cover, so let's just take a look at my Daily Notes template and you can get a small idea of what the plugin can do.

---
creation date: <% tp.file.creation_date() %>
modification date: <% tp.file.creation_date("dddd Do MMMM YYYY HH:mm:ss") %>
---

<< [[<% tp.date.now("YYYY-MM-DD", -1, tp.file.title, "YYYY-MM-DD") %>]] || [[<% tp.date.now("YYYY-MM-DD", 1, tp.file.title, "YYYY-MM-DD") %>]] >>

## Timelog


## Meetings

At the top it starts off with a creation date and a date that the file was modified. This came from their stock example, I have no idea what I'd use it for but I left it in.

Next up is some navigation on a daily note so that you can move from it to a day before or after. You can see full documentation on Templater variables here. My variables create a link with my date format and use the name of the current file as the basis to figure out the date.

I had to change that because the default example I found always used the current calendar date of your computer, but I often create daily notes months in advance to remind me of something. I have a few hanging around in September that will link to sometime in early June...but I'll jump those hurdles when I get to them.

If you're looking for more examples on what Templater can do, there is a great Obsidian forum thread with lots of examples. Thanks to Anthony Baker for pointing me to that Obsidian forum thread.