I’m trying to build a template for “topic pages”, i.e., pages that include all blocks with a specific tag.
Currently, I’m still experimenting on a single example page, without trying to add the extra complexity layer of templating.
The idea is as below (very simple, and solutions for this can be found in a number of places). This is actually very similar to the Linked References auto-included block at the bottom of pages, but I’d like some extra formatting power. (But if anyone can link me to the query powering Linked References, I’d be happy to start building on top of that.)
This solution to what I understood to be a similar problem doesn’t work unfortunately.
-
The page (named
Foo Bar) has some frontmatter (page properties), and pulls in all blocks with the tagfoo-barin an Advanced Query:type:: topic topic:: foo-bar alias:: foo-bar - ## Notes - Something on the Foo Bar page itself - #+BEGIN_QUERY {:title [:h2 "Related blocks"] :query [:find (pull ?b [*]) :where [?p :block/name "foo-bar"] [?b :block/refs ?p]] :result-transform (fn [r] (map (fn [m] (assoc m :block/collapsed? true)) r)) :group-by-page? false :remove-block-children? true :breadcrumb-show? false } #+END_QUERY -
This works fine in principle, but the properties block is pulled in as well:
I’ve searched here and the wider web and tried to find a solution for excluding either blocks that are on the same page as the query, or blocks that contain an alias:: property, but couldn’t get it to work.
This query by @Siferiax is elegant, but also includes the property block.
Does anyone have any ideas how to achieve excluding the property block?
Many thanks!
