This article continues the series on automating Daily Notes in Obsidian. This time we explore including Dataview queries in the Daily Note template so certain information appears every time we create a Daily Note. The examples to be used here will be to create three queries. The first is a reminder for articles I intend to write. The second shows me all notes I have created on the date of the Daily Note and the third shows all notes I have worked on or modified on that day.
Bear in mind that these are just examples that suit my particular needs and you can use dataview to include all sorts of different queries. References to help and assistance will be included at the foot of this article.
Callouts in Obsidian
I always put my Dataview queries in Callouts. This is just a personal preference because I can hide the query results or have them display by default. The callouts also display in a manner that creates contrast in my notes. You can find out more about callouts in another article I have written on compacting Obsidian notes.
Obsidian has quite a number of callouts you can use. You might like to explore the Community Plugin “Callout Manager” for ideas. For the purposes of this article however, we will confine ourselves to a simple callout.
1. Articles to Write
This dataview query is based on a tag in any note I start where I intend to write an article. If you have followed other examples of videos and articles you will be familiar with putting the following frontmatter at the top of your note via a template so it appears in every new note. Refer to this article for more information.
up:: Link to next note up the hierarchical chain
tags:: # todo/write (remove space between hash and first letter)
For every article I intend to write, I create a note as a placeholder and structure it with that tag. Once the article is written, the # todo/write tag is removed in the publishing process.
So back to the Daily Note. In the area where you wish to have these articles insert the following code assuming you are using the same tag mentioned above.
>[!EXAMPLE] Articles To Write >LIST >FROM #todo/write >SORT file.name asc
If you don’t want the callout to be displayed in full view, then add a minus sign after the closing bracket of EXAMPLE. Once you exit the code area, the callout should display as follows.
Another method of doing something like this is to create a specific note called “Articles to Write” or whatever it is you wish to keep track of. Put the dataview query in that note and then create a Bookmark using Obsidian’s new core plugin to take you to that specific note. Nick Milo has just made an excellent video on this new feature.
2. Notes Created Today
This callout will automatically record all new notes you have created today. I keep this at the bottom of my Daily Note. The code for this is very simple:
>[!EXAMPLE]+ New Today >LIST >WHERE file.cday = this.file.day >SORT file.name asc
This query is simply searching for all files where the creation date (file.cday) is equal to today (this.file.day) and then sorts the files in ascending order. Done correctly, it should display similar to the below example.
3. Note Modified Today
A similar query to the one above but tells you all the files you have worked on today. This will include any you have created because you have worked on them too. The code to generate this callout is:
>[!EXAMPLE]+ Modified Today >LIST >WHERE file.mday = this.file.day >WHERE !contains(file.path, "91.23 - 2023") >SORT file.name asc
This query is looking for files modified (file.mday) that equal today (this.file.day) and are not located (!contains) in the folder where I keep all my Daily Notes (file.path, 91.23 – 2023) and then sorts the files in ascending order.
These are just a couple of examples of what can be done in your Daily Notes, or other notes for that matter, with Dataview queries. It is a very powerful plugin and we have only just scratched the surface. Some people write some truly amazing queries using the plugin. So good luck with these beginner queries and I hope it adds some interesting viewing to your Daily Note that is automated.
Basic Dataview Query Builder
Obsidian Callout Plugin (but available by browsing Community Plugins in Obsidian)
Nick Milo’s excellent video on Bookmarks