Skip to content

Instantly share code, notes, and snippets.

@zamuz
Last active September 8, 2025 19:01
Show Gist options
  • Select an option

  • Save zamuz/7b8a80c32384808063ddb78de460dd64 to your computer and use it in GitHub Desktop.

Select an option

Save zamuz/7b8a80c32384808063ddb78de460dd64 to your computer and use it in GitHub Desktop.
Index page for Silverbullet v1 instances
{{#each {page where tags != "template" and tags != "meta" order by created desc}}}
### [[{{name}}]]
  _{{niceDate(created)}}{{#each tags}} [[πŸ“Œ {{.}}|#{{.}}]]{{/each}}_ 

{{/each}}
# TAGS

{{#each {tag select name where parent != "builtin" order by name}}}
_[[πŸ“Œ {{name}}|#{{name}}({{tagCount(name)}})]]_ {{/each}}
# TASKS

{{#let @pages = {task select page where not done and itags != "meta"}}}
{{#if @pages}}
{{#each @p in @pages}}
**[[{{@p.page}}]]**{{#each {tag where page = @p.page}}} _[[πŸ“Œ {{name}}|#{{name}}]]_{{/each}} 
{{#each {task where page = @p.page and not done order by pos asc}}}
- {{text}}
{{/each}}

{{/each}}
{{else}}
_All done._
{{/if}}
{{/let}}
# LATEST
[[All pages|Show all ({{tagCount("page")}})]]

{{#each {page where tags != "template" and tags != "meta" order by created desc limit 15}}}
### [[{{name}}]]
  _{{niceDate(created)}}{{#each tags}} [[πŸ“Œ {{.}}|#{{.}}]]{{/each}}_ 

{{/each}}
silverbullet.registerFunction({name: "tagCount"}, async (tagName) => {
  let result = await syscall(
    "system.invokeFunction",
    "index.queryObjects",
    tagName,
    { filter: ["!=", ["attr", "tags"], ["string", "template"]] },
  );
  return result.length
});
@dhemasnurjaya
Copy link

dhemasnurjaya commented Jun 27, 2025

@zamuz can you update this to work with Silverbullet v2? thanks!

@zamuz
Copy link
Author

zamuz commented Jul 7, 2025

I tried to update it for Silverbullet v2 but the move to Lua has proven a bit too involved for me. I'm still on Silverbullet v1 for the foreseeable future. Sorry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment