Skip to content

Instantly share code, notes, and snippets.

@exdeejay
Last active March 30, 2026 16:12
Show Gist options
  • Select an option

  • Save exdeejay/d342d9c18d1a28f1d56b0718028026a4 to your computer and use it in GitHub Desktop.

Select an option

Save exdeejay/d342d9c18d1a28f1d56b0718028026a4 to your computer and use it in GitHub Desktop.
Obsidian Dataview snippet - List all tags sorted by frequency of use
## Tags
%% Copy the below text, including the ```, to use in your own file %%
%% Make sure to turn on "Enable Javascript Queries" in Dataview's settings! %%
```dataviewjs
// List all tags sorted by frequency of use
let tags = dv.pages()
.flatMap(page => page.file.tags)
.groupBy(tag => tag)
.sort(tag => tag.rows.length, 'desc')
for (let tag of tags) {
dv.span(tag.key + ' ')
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment