A very messy workaround, but a workaround
tl;dr: I created a note that links to the base tag and all its nested tags, pulling them together on the graph. And hacked together an automated way to pull nested tags given a base one.
I originally, for the laughs, created a note named after the base tag, even with the #
, #geo
(subtags of which I use in locations for Map View, like #geo/beach
). Having the note, I just went ahead and mentioned every tag nested under it in that note. Manually. And once I opened the graph, it seemed to work perfectly! I put that note into its own folder and assigned it a color so that it would blend in with the other tags.
E-e-e-except for one small problem. When trying to extend that practice to other tags I learned that this was only working fine because the base tag was not in use. So when I created a note that only had the base tag, #geo
itself, I suddenly had two dots on the graph named #geo
— one for the tag and one for the note. That was confusing. And thanks to my color hack I couldn’t even tell them apart So I assigned this note a different color of course.
…and I later discovered that Obsidian on Android cannot create a file with #
in the name. So I had to remove it from the note name anyway. It worked on Windows though.
But on second thought — it actually did the job! It pulled the nested tags together! Sure, there’s one unnecessary link and the base tag got hard to spot, but the structure is mostly there. I just had to mention the base tag in the “pulling note” (as I’ve gotten to call them) too, in order to not have it dangling elsewhere.
Automation
Now, of course I had to automate this. Gathering tags by hand is tedious. I solved some of this using Dataview plugin. I mention the base tag I want to pull the subtags of, place this snippet on the page and, well, follow what it says:
Automation snippet to maintain the list (copy&paste its results from preview window into the file):
```dataviewjs
let currentPage = dv.page(this.currentFilePath)
let pageTags = currentPage.file.etags;
let query = pageTags.join(" or ");
let queryTags = (query === "")
? []
: dv.pages(query).file.etags.array();
dv.paragraph(
[...new Set(queryTags)].join(" ")
);
```
- Sadly, this only really handles single-level tag nesting, because it gets all of the descendants of mentioned tags, not just direct children! This is JavaScript though, so it’s got to be fixable. I haven’t (yet?) gone that deep into the tags.
- It already does not match ancestors: if you mention a nested tag, it’s not going to return the base tag of it in the result.
- Still a bit of manual action whenever a new tag is introduced. But the snippet does make initial setup easier, and makes future tagging sprees manageable.
- It handles multiple base tags just fine. That goes beyond the workaround, but the snippet does not care.
Better than nothing overall. I hope this helps someone out there.
Still waiting for a native solution though. Pretty please?