Logseq Resources: Datalog Examples, Custom Table Views & Useful Links

Logseq Resources with properties, datalog, custom view and table

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


logseq resources for building a query

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 one pull 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


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

About Erik Calco

With a passion for Investing, Business, Technology, Economics, People and God, Erik seeks to impact people's lives before he leaves. Contact Erik
This entry was posted in Technology, Learning, Productivity and tagged , . Bookmark the permalink.

Leave a Reply