Some examples for SilverBullet queries:
Pages
📃 Same page query
Frontmatter syntax
---
url: https://silverbullet.md/
repo: https://github.com/silverbulletmd/silverbullet
info: open source, web based PKM
---
Query syntax
same page as frontmatter
page where name = "{{page}}" render [[templates/your-template]]`
Template syntax
- [URL]({{url}})
- [Repository]({{repo}})
- Info: {{info}}
📂 Folder hierarchy current site
This can be useful if you want to have a quick overview for every page that is in the current “folder”.
below the current page
Query syntax
💡 Regex, page begins with the same name as the current site, followed by a /
page where name =~ /^{{page}}\//
Template syntax
- [[{{name}}|{{name}}]]
You can replace {{page}}
with a page if you want to embed it from another page.
📂 Folder hierarchy but only one layer
This could be helpful if you want to query every “root” page, but no more subfolders.
Query syntax
💡 Regex, page begins with the same name as the current site, it shows all entries except when there follows a second /
(which would mean a subfolder)
- ✅ Software/nmap
- ✅ Software/n-m-a-p
- 🚫 Software/nmap/service
page where name =~ /^{{page}}\/[^\/]*$/`
Template syntax
- [[{{name}}|{{name}}]]
Like before, you can replace {{page}}
with a page if you want to embed it from another page.
📅 Query date attributes
If you have dates in page attributes you can filter them. Especially useful if you want to do it for every page in a folder like in this example.
Query syntax
💡 Regex, page begins with the same name as the current site, followed by a /
. Only entries later than 2023-01-01
page where name =~ /^{{page}}\// and started-on > "2023-01-01"
started-on > "2023"
would work too
Frontmatter Syntax
---
name: Javascript for beginners
started-on: 2023-02-05
finished-on: 2023-03-14
---
🏷️ Pages that have tags in frontmatter
page where tags = "YourTag" and tags = "YourOtherTag"
📅 Show the last 10 daily notes
Query syntax
💡 Pages that start with the 📅 emoji, ordered by name (date) in descending order and limited to 10
page where name =~ /^📅/ order by name desc limit 10
🏋️ Show top 10 biggest pages
Query syntax
💡 Query for all pages ordered by size, ordered descending, limited to 10
page order by size desc limit 10
Template syntax
* {{size}} byte: [[{{name}}|{{name}}]]
Tags
🔲 all unfinished tasks
task where done = false
☑️ all finished tasks
task where done = true
📅 tasks between two dates
task where deadline >= "2023-03-01" and deadline <= "2023-03-31"