
Purpose: A lightweight logseq resources hub you can link to from other posts. It’s useful for readers today and will grow into a cluster landing page as more Logseq articles are published.
TL;DR
- Copy‑paste datalog examples and a minimal custom table view pattern.
- Quick references for block properties, page names, and common shape gotchas.
- Links to official docs and community threads that actually help.
If you came from the main tutorial, jump back: Advanced Logseq Queries for Real‑World Catalogs: From Zero to Powerful
Contents

Quick‑Start Datalog Examples
Return blocks that have specific properties (item‑page, item‑title, item‑url):
:find ?b ?props
:where
[?b :block/properties ?props]
[(get ?props :item-page) ?_]
[(get ?props :item-title) ?_]
[(get ?props :item-url) ?_]
Normalize set values (common for page refs):
(let [pgv (:item-page props)
pg (if (coll? pgv) (first pgv) pgv)])
Minimal Custom Table View (paste into :view
)
(fn [rows]
(let [pairs (partition 2 (into [] rows))]
[:table
[:thead [:tr [:th "Item page"] [:th "Resource"]]]
[:tbody
(for [[_ p] pairs
:let [pgv (:item-page p)
pg (if (coll? pgv) (first pgv) pgv)
t (:item-title p)
u (:item-url p)]]
[:tr
[:td [:a {:href (str "#/page/" pg)} (str pg)]]
[:td [:a {:href (str u)} (str t)]]])]]))
Data Model Cheat Sheet
- Page names stored as lower‑case
:block/name
(slashes preserved). - Block properties live under
:block/properties
as a map; many values are sets → use(first …)
. - Hyphens vs underscores: query with the stored keyword (Logseq exposes hyphenated keys).
Common Gotchas (and fixes)
- Shape mismatch errors: build queries small → confirm
:find
row shape → then add columns. - Mixing
pull
+ scalars in one:find
: avoid when you plan to reshape; prefer onepull
or all scalars. - Sorting newest first: sort by block id in the
:view
instead of leaning on timestamps.
Logseq Resources: External Guides & Threads Worth Bookmarking
- Logseq Docs – Advanced Queries —
(Start here; official documentation hub.) - Logseq Forum – Queries category —
(Active Q&A; search real-world patterns and pitfalls.) - Awesome Logseq (community curated) —
(Plugins, themes, examples; good jumping-off point.) - DataScript (Datalog engine Logseq uses) —
(Core docs, README, and links to cljdoc/clojars.) - Clojure Cheatsheet (official) —
(Handy when writing smallfn
/let
forms in:view
.) - Hiccup (HTML via vectors) – GitHub —
(The library used conceptually by Logseq’s hiccup-style views.) - Hiccup mini‑guide (tutorial) —
(Quick primer if you’re new to hiccup.) - Logseq GitHub – Query issues label (examples & edge cases) —
(Search open/closed issues for query-related behavior.) - Custom
:view
examples – Tienson Qin’s gist —
(Minimal table rendering examples.) - Advanced queries cookbook gist —
(Community snippets to study and adapt.)
More From This Site
- Main tutorial: Advanced Logseq Queries for Real‑World Catalogs → hands‑on guide with full screenshots.
- Browse the Logseq tag for new posts as they land.
- See more in Technology.
FAQ (short and practical)
How do I turn block properties into a table?
Bind from :block/properties
, normalize set values, and render a custom :view
with :table
.
Where should the dataset live?
Anywhere; scoping to a page is optional. Start broad, then filter.
What Logseq version are these patterns for?
Tested with 0.10.x and forward‑compatible with minor tweaks.
Suggested “Paste‑Ready” SEO Box (optional)
- Title (≤60): Logseq Resources: Datalog Examples & Custom Table View
- Meta description (120–160): Copy‑paste Logseq datalog examples and a minimal custom table view pattern. Quick references for block properties, page names, and common gotchas—plus links to the main advanced‑queries tutorial.
- Slug: logseq-resources (or keep whatever your theme generates)
Our Logseq Resources and Articles
Advanced Logseq Queries for Real‑World Catalogs: From Zero to Powerful