Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save harmonify/717d0b721505d74bb409936552b92645 to your computer and use it in GitHub Desktop.
Save harmonify/717d0b721505d74bb409936552b92645 to your computer and use it in GitHub Desktop.
These are templates that will query all mentions (ingoing links) in a MOC. Requirements are Obsidian Dataview and Obsidian Templater plugins.

Obsidian MOC Templates with Dataview & Templater Plugins

This gist contains templates that will query all mentions (ingoing links). You can use it as a MOC template. Required plugins:

  • Obsidian Dataview
  • Obsidian Templater
function getFirstChar(page) {
  return page.file.name[0]
}

const source = dv.pages("[[<% tp.file.title %>]]")
  .groupBy(getFirstChar);

for (let group of source) {
    // use markdown heading 3 (###) for header
    dv.header(3, `${group.key} (${group.rows.length})`);

    // list version
    const listRows = group.rows.map(k => k.file.link);
    dv.list(listRows);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment