Cassidy Williams

Software Engineer in Chicago

Cassidy's face

How I use Obsidian Dataview


It’s day 22 of Blogvent, where I blog daily in December!

Yesterday, I wrote about how I use Obsidian Templater to generate templates across similar notes.

I also really like to use Obsidian Dataview! Dataview lets you query your notes as data, which is pretty dang powerful, especially when you have a lot of notes that follow similar structures and patterns.

My newsletter “dashboard”

Because I write all of my newsletter issues in Obsidian, and they all use the same template (which again I shared in yesterday’s post), I often want to see all of my issues at a glance.

I have a “Newsletter Dashboard” note in my Obsidian vault that has links to other notes of mine (like notes about feedback from subscribers, sponsor notes and ad copy, blurbs I want to remember, or just various things I regularly keep track of), and then a table of all of the issues I’ve written.

Normally, it would be a small task to plop a link to the latest issue I wrote into the table. Not a time-consuming one, definitely small, but one that I’d have to do every week.

…which means of course, I had to automate it.

It’s the perfect use of Dataview! In my vault, I have a Dataview block:

```dataview
TABLE striptime(dates.created) as "Issue Date"
FROM #newsletter
WHERE contains(alias, "Newsletter")
SORT dates.created desc
```

It looks a lot like a regular markdown code block, BUT notice that it has dataview at the top as the language. This toggles the plugin!

Broken down:

  • A table is generated with two columns, one with the file name (which is a default), and then another with the “Issue Date” (which comes from the newsletter’s frontmatter)
  • The table is populated with any files in my vault that have the tag #newsletter
  • Because I have other “meta” notes about my newsletter with the #newsletter tag, I also make sure that the files queried have the word “Newsletter” in the file’s alias (which my issues will always have, because of their template)
  • The table is sorted by date, where the newest issue is at the top

This has made my life so much easier for organizing my newsletter issues!!

A generic, generated “dashboard list” template

That being said, I also have a much simpler Dataview usage that combines with Obsidian Templater in a way that you might enjoy using.

Sometimes, I have a lot of notes that reference a certain topic with the Obsidian [[linking]] syntax. For example, when I take notes at church, I might reference a book of the Bible like [[Matthew]] or I might write notes about a book I’m reading across several files, and will use [[Book title]], or if I’m taking a class, I’ll use [[Class Name]].

Obsidian has native ways of viewing the links between files, but if you want to make your own “dashboard” of sorts about a given topic and all of its references, you can use this template:

---
cuid: listdashboard<% tp.file.creation_date("YYYYMMDD-HHmmss") %>
alias: "List of notes about <% tp.file.title %>"
tags:
---

# <% tp.file.title %>

References to <% tp.file.title %>:

```dataview
LIST
FROM [[<% tp.file.title %>]]
```

It’s FUNKY but it’s so powerful! What it does is:

  • Creates an ID for the dashboard based on the date
  • Creates an alias for the dashboard
  • Offers the line to add tags in the frontmatter
  • Generates a heading for the note based on the topic
  • Generates a list of all notes about that particular topic with Dataview

So, for example, I sometimes write down pieces of advice I read from the Indie Hackers Newsletter that I want to remember. Whenever I do, I reference it with [[Indie Hackers Newsletter]], and my note generated from this template looks like this:

---
cuid: list20210727-223242
alias: "List of notes about Indie Hackers Newsletter"
tags: advice, startups, saas, projects
---

# Indie Hackers Newsletter

References to Indie Hackers Newsletter:

```dataview
LIST
FROM [[Indie Hackers Newsletter]]
```

(and then more general notes below this)

The generated list here has over a dozen of my notes linked, and I can have a more “meta” overview of the topic about the newsletter (like who writes it, what else I might need to know, etc) by just writing more in this generated markdown file.

It’s SO handy for lectures I watch (or create), books I read, recipes I follow, and even just certain kinds of meeting notes! I have probably over a hundred “meta” notes generated from this template alone, and it’s been great for staying organized.

It gets way more complex

These are honestly very basic usages of Dataview, but they work for me. I recommend reading the documentation for the plugin and checking out how people use it in the broader Obsidian community, because I’ve seen some really impressive usage around things like task management and even Dungeons & Dragons campaigns!

See you again tomorrow!


View posts by tag

#advice #personal #musings #events #learning #technical #work #meta