Obsidian’s core-template plugin is better than you expect. Sure, you can have it automatically apply templates based on conditions like folder, but there’s some hidden features of it.

Template for creating new files

If you unbind the hotkey create new note and instead go enable the core-unique-notes plugin, you can bind the ctrl/cmd+n hotkey to create new unique note. The unique-note plugin has the option of a template file to be used. Not clue why that’s not available for creating notes the default way.

One side effect of this, is that it doesn’t apply to new notes created via either:

  • Right clicking a folder and using the context menu
  • Clicking the “new note” button in the top left
  • Clicking on an Orphaned link.

I don’t create most of my notes this way and the ones that I do, don’t fall into my usual category of note taking.

Update Frontmatter with Templates

Lets say you have a blog post and you’re ready to publish. You’d probably want to save the date of when you publish, and in my case I also want to add the publish property so that quartz will publish the article for me.

You can easily do this by making a template called “publish-blog-post” with the content:

---
date: "{{date:YYYY-MM-DDTHH:mm:ss}}"
publish: true
---

Obsidian will then recognize this as frontmatter and instead of just pasting this where your cursor is in the note, it will update the frontmatter of the current note. Its important to note, that it won’t replace the old one with the new, its even better, it will update the values that are different and leave any others untouched.

So if we run that template, we’ll have a fresh date time string replacing the old one and publish will be (added if not present and) set to true.