I’m fiddling with implementing JD in Obsidian for my personal and academic duties. I chose the “one note per ID” strategy, because it looks the easiest. However, I realised that I would still like to have an index file, so that it is quicker to scan through the IDs on mobile.
After a bit of online search, I implemented a dynamic index file via the Dataview plugin (with dataviewjs
enabled).
Here is a test vault with the structure:
The 00.00 Index.md
file looks like this:
# Index
```dataviewjs
let categories = dv.pages('"00-09 System management/00 Meta-system/00.01 Index notes"')
.sort(p => p.file.name)
.groupBy(p => p.file.frontmatter.jdcategory)
let areas = dv.pages('"00-09 System management/00 Meta-system/00.01 Index notes"')
.sort(p => p.file.name)
.groupBy(p => p.file.frontmatter.jdarea)
for (let area of areas) {
dv.header(2, area.key);
let areaNum = Math.floor(Number(area.key.slice(0, 2)) / 10);
for (let category of categories) {
let catNum = Math.floor(Number(category.key.slice(0, 2)) / 10);
if (areaNum == catNum) {
dv.header(3, String(category.key).padStart(2, '0'));
dv.list(
category.rows
.sort(k => k.file.name)
.map(k => k.file.link + ": " + k.file.frontmatter.jddescription)
)
}
}
}
```
For this to work, each JDex ID entry note should have
---
jdarea:
jdcategory:
jddescription:
tags:
---
in the YAML frontmatter.
The pros I found for this approach are:
- I am less likely to duplicate IDs, because I can take a look at the used ones first from any device;
- by copying the dynamic result and pasting it elsewhere, I obtain a static single-file JDex.
There are cons, of course:
- creating a new entry takes more time;
- if Obsidian is not available, one still needs to scan the entries’ folder and look for an empty ID.