Automated maps of content in Obsidian with Templater and Dataview
In the “lore of Obsidian” a Map of Content (MOC) is a rather vague idea of a note (or collection of notes) that links to other notes. Having and creating these “list of links” can do various things and provide various benefits - which I think is a reason why the concept is rather vague.
For example, having “higher-level notes” can make it easier to find what you are looking for because you can move up and down levels of generality to find roughtly what you want - then exactly what your wand; the act of making a map forces you to abstract your notes and make connections between concepts; also linking your notes to a core “home note” can force you to make sure your notes are consistent with you and your aims; but also linking your notes to a project in the future can make them more useful.
It’s quite a general topic for quite a simple technology of pages with links. I would define a map of content as a collection of pages, which mostly consist of links, and exist mainly for the purpose of linking to other pages.
This post by Obsidian Rocks gives an introduction to maps of content and cites linking your thinking as the originator the idea. Though it is to be noted that similar ideas exist in Zettelkatsen with structure notes.
Automatic maps of content
While there can be value of maintaining this map by hand - done, for example, by ensuring that every note has one or more parent, and inserting a link to new notes into this parent - at times, you can also want a degree of automation to help in your maps of content.
For example, I often use a snippet like this to display all the notes with a particular tag on a page “about the tag”
```dataview
LIST FROM #
```
These “automated MOCS” can be useful when you already know the structure you want to use, when you know that you will have lots of notes, and to “save effort” when creating notes by avoiding having to maintain the map. This is less useful when part of your aim is creating the map - for example to understand the relationship between different ideas.
Examples of places where I have used these “automated maps” are keeping tracks of words while learning Danish, and noting down how to do things using a computer.
I have used Dataview together with Templater to help me automate maps. I’ll explain how to do this now.
Display all notes with a tag
If you are collecting atomic notes with tags - you can use Dataview to find all notes with a one or more tags. I often add this view to the end of a MOC, like an index.
I have the following Templater template for this (which I call moc-tag)
```dataview
LIST FROM #
```
Then, I have a shortcut (Alt-E) for Templater: Open insert template modal
and so can insert this template with a couple of key presses.
You can combine several tags using “AND”, like so:
```dataview
LIST FROM #tag1 AND tag2
```
One downside of this approach is that you end up with parallel tags and maps of content, where a map of content often represents “all pages with this tag”. Using the an approach with backlinks or properties avoid this problem.
See also: Creating typed links in Obsidian using properties.
Display all notes that link to the current node
Another use “automated map” you can add is a link to all elements that link to a topic. People refer to these notes as backlink. I use the following template for this (called moc-backlinks)
```dataview
LIST without id x WHERE file.name = this.file.name FLATTEN file.inlinks as x
```
One downside is that links can be rather “inadvertant” and note necessarily that meaningful and can pull in more of your knowledge base than you want. An alternative approach is to use properties. Which I’ll talk about another time.
A note on search all files
Just a quick note that you can carry out similar queries to these using Search in all files
but this has the benefit of being permanent.
Manual versus automated
Returning to the point on manual versus automated MOCS, I’m undecided on whether this automated approach is better than a manual approach. One thing that I’m sure of is that you should change your taxonomy as you go and start off with what works at the moment.
One thing that I have noticed is that notes that are more reference’y seem to prefer tag based organization - partly because I don’t expect to come back to them. While notes that are more related to thinking or projects tend to “grow a little more over time” so the manual MOC may be better because it encourages thinking and is less fixed.
Also, sometimes I want to create a lot of notes for some reason - and then maintaining the map of content seem unnecessary and time consuming, since you aren’t really learning anything by updating the manual map of content. Having this sort of automated query can help you build your manual map by displaying results.
Finishing up
So that’s that. It’s perhaps unsurprising that the tool that allows you to query your knowledge base can be used to create maps of your content. But I think talking about manual versus automatic maps of content is useful - and the idea of using a template is quite fun.
I am @readwithai. I’m making tools in Obsidian for productivity, agency and reading. If you found this post interesting you might be interested in my (slightly academic) page on how people use Obsidian for note taking or my howto cookbook for Obsidian.
If you are interested follow me on X or subscribe here.
Also here’s a demo of my new Obsidian plugin called Plugin REPL which is coming soon: