Making an Index with Dataview

What I’m trying to do

I have a “☆Topics” folder that contains individual notes for each topic, which act like tags (e.g., “Movie” or “Video Making”). Each topic note has a property called “TopicCategory,” which is filled in with something like “Genre” or “Media.”

In the “☆Topics” folder note, I want to create an index for these topic notes.

Ideally, I would like a table that can do the following:

  • automatically categorize topic note links by TopicCategory (including notes with no category.
  • Organize both TopicCategories and their related notes alphabetically
  • Identify notes that have no links to regular notes within them
  • Identify the last date a note was modified

It would be nice if I didn’t need to edit code whenever I make a new TopicCategory.

Things I have tried

Before, I had a separate note for each topic category that linked to topics under that category. I wanted to avoid this route to have fewer notes, but I will go back to it if necessary for a better index. If I did this again, my index would have a simple alphabetical list for topics and a separate list for topic categories.

So far, I have been manually categorizing my topics with headers and text properties:

Genre
LIST
FROM "☆Topics"
WHERE TopicCategory = "Genre"
SORT file.name ASC

This works fine, but it is a little tedious and less useful.

If TopicCategory is text (not a list), then you could try:

```dataview
TABLE WITHOUT ID TopicCategory AS "topic category", rows.file.link AS "topic", rows.file.mtime AS "last modified"
FROM "☆Topics"
WHERE file.path != this.file.path
SORT file.name ASC
GROUP BY TopicCategory
SORT TopicCategory ASC
```

… to see all topics grouped by topic category (including notes with no category), alphabetically, and with date last modified:

For the notes that don’t link to other notes, try:

```dataview
TABLE WITHOUT ID file.link AS "topics that don't link to any notes"
FROM "☆Topics"
WHERE file.path != this.file.path AND length(file.outlinks) = 0
SORT file.name
```

… which should give you something like:

That assumes the topic note doesn’t link to any note at all. I wasn’t sure what you meant by “have no links to regular notes within them”. If you mean that topic notes could link out but you’re interested in links only to certain types of notes, then can you explain which types / the difference?

1 Like

Thanks so much!

And, yes, I did mean topic notes that don’t link to any other notes (Topics I’m interested in, but haven’t explored). Not sure if this will change in the future because I considered linking similar topics, but I think I’ll stick with this method.

1 Like