An Obsidian Template To Create A File At The Right Location
In my blog, this post you're reading right now can be found at the following path in the repo:
content/blog/2025/06/03/obsidian-templater-file-creation-template.md
Yesterday's dailydogo1284 has the following path:
content/blog/2025/06/02/dailydogo1284.md
So all my posts are living in a tree like this:
- blog
- year
- month
- day
- post
- day
- month
- year
I remove the "blog" part from the path and let eleventy slugify it. Et voilà.
I am using Obsidian as my editor for blog posts. And I don't want to create all these directories every day just to write and publish a little note. So I automated it away using an Obsidian Plugin called Templater. Here's the template:
---
title: <%tp.date.now("YYYYMMDDHHmmss")%>
aliases: <%tp.date.now("YYYYMMDDHHmmss")%>
draft: true
date: <% tp.file.creation_date("YYYY-MM-DD[T]HH:mm:ssZ") %>
lastmod: <% tp.file.last_modified_date("YYYY-MM-DD[T]HH:mm:ssZ") %>
tags:
- Memories
---
<%*
const moment = tp.date.now("YYYY/MM/DD");
const filePath = `content/blog/${moment}/${tp.date.now("YYYYMMDDHHmmss")}.md`;
await tp.file.move(filePath);
%>
<% tp.file.cursor(0) %>
If I create a new file using the "Templater: Create new note from template" command, I can basically start writing immediately.
-
← Previous
Publishing More Quick Notes -
Next →
John Berger's Ways Of Seeing