From 37002b305e3912feefffc067f8a5c9f777ac126b Mon Sep 17 00:00:00 2001 From: Connor Rhodes Date: Fri, 22 May 2026 14:15:05 -0500 Subject: [PATCH] document tag filtering pitfall: always use table.includes() --- silverbullet-query/SKILL.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/silverbullet-query/SKILL.md b/silverbullet-query/SKILL.md index b3bb485..4bff2a4 100644 --- a/silverbullet-query/SKILL.md +++ b/silverbullet-query/SKILL.md @@ -45,6 +45,9 @@ where p.name:startsWith("proj/") -- Pages with a specific tag where table.includes(p.tags, "account") +-- Pages WITHOUT a specific tag +where not table.includes(p.tags, "account") + -- Pages matching name where p.name:startsWith("Person") @@ -55,6 +58,8 @@ where t.page == _CTX.currentPage.name where p.name:startsWith("proj/") and table.includes(p.tags, "active") ``` +> **Important:** `p.tags` is always an array (possibly empty) on every page. Do NOT use `p.tags` or `not p.tags` as a boolean check — an empty array is still truthy in Lua, so `not p.tags` is always false. Always use `table.includes()` to check for specific tags. + ### Sorting (`order by`) ```