How I created a “On this day” feature in Obsidian for my journaling
I journal almost daily writing my thoughts into Obsidian. They appear as entries in my Daily post. Previously, I journaled in DayOne. There I wrote using Markdown format for a few years. When I switched to Obsidian I was able to export everything from DayOne in Markdown format. When I imported they entries into Obsidian, I got this file/folder structure.
<img src=“https://cdn.uploads.micro.blog/8969/2025/492db98be7.png"height="400" alt="">
In the image you can see that I have a top-level folder called “DayOne” with subfolders for each notebook (or whatever it was called in DayOne). In “Tagebuch” (That’s journal in German) I have all my daily journal entries reaching back until 2012. DayOne had this awesome feature called “On This Day” where you were presented with all your entries from the current day from previous years.
I built that for myself in Obsidian and now I’ll share how I did it.
First, create the note that you want the contents to show up in. I called it “On this day”. You will need the Dataview plugin. In your note create a dataview snippet like this. I’ll explain what it does in a second:
dataviewjs
const date = dv.date('today')
const todayDay = date.day
const todayMonth = date.month
dv.list(
dv.pages('"DayOne"').where(p =>
p.dates && p.dates.length > 0 &&
p.dates[0].month === todayMonth && p.dates[0].day === todayDay
).distinct().forEach(page => {
dv.paragraph("![["+page.file.path+"]]")
})
)
dv.list(
dv.pages('"1 Projekte/0 log/daily"').where(p => {
const fileDate = dv.date(p.file.name);
if (fileDate) {
fileDate.month === todayMonth && fileDate.day === todayDay
} else { return false }
}).distinct().forEach(page => {
dv.paragraph("![["+page.file.path+"]]")
})
)
What I am doing here is getting today’s day and month. I don’t care for the year since I want to have entries for all previous years. Then I use the Dataview feature of creating a list from the pages inside a folder: dv.list(dv.pages('"DayOne"')
The double quotes inside single quotes is a Dataview thing. It’s documented and simply has to be like that.
Then I filter the list of all the pages in the DayOne folder by day and month:
.where(p => p.dates && p.dates.length > 0 && p.dates[0].month === todayMonth && p.dates[0].day === todayDay)
. This works because my frontmatter in Obsidian has a dates
entry that is of the type date. It’s not only text but Obsidian knows this is a date and can separate it into day and month components. The frontmatter was setup by DayOne and part of the export of the entries.
For my own journal entries created in Obsidian I don’t always have that date in the frontmatter. But I have the date as part of the filename. That’s what I deal with in the second part of that Dataview query. I parse the filename and create a date from it so I can again compare the day and month: const fileDate = dv.date(p.file.name)
What’s remaining for both list of pages is to create paragraphs that get embedded into the current note/page so I can see the contents of the entries:
.distinct().forEach(page => { dv.paragraph("![["+page.file.path+"]]") })
The syntax ![["+page.file.path+"]]
is typical Obsidian for embedding a note that you know the name of.
Everytime I open the On This Day note in Obsidian the whole Dataview query is run and the contents updates.
It also shows images: