All page references in the current page

A query that finds all page references in the current page and lists page references in a column (so I can sort by [[page reference]]…).

An example

I think I’ll use it in the journal…

I tried these queries but with no results: Query to list all blocks in current page which are references once or more

Something like this:

#+BEGIN_QUERY
{
 :inputs [:current-page]
 :query [:find ?ref-name (pull ?b [*])
   :in $ ?current-name
   :keys ref b
   :with ?ref
   :where
     [?current :block/name ?current-name]
     [?b :block/page ?current]
     [?b :block/refs ?ref]
     [?ref :block/name ?ref-name]
 ]
 :result-transform (fn [result]
   (map (fn [r]
     (update (:b r) :block/properties (fn [p]
       (assoc p "reference" (:ref r) )
     ) )
   ) result)
 )
}
#+END_QUERY
1 Like

You are as capable as you are kind.
Thank you very much!