All tasks pointing towards the current page
This shows all the TODO’s that are pointing towards the current page, I use this as a template to quickly get a query on the top of People/Project pages.
1template:: Query - Current Page Tasks Advanced
2#+BEGIN_QUERY
3{
4:title [:h2 "Open Tasks <% current page %>"]
5:query [:find (pull ?b [*])
6 :in $ ?tag
7:where
8 [?p :block/name ?tag] ; name is always lowercase
9 [?b :block/refs ?p] ; this block references ?p as oppose to being on ?p through :block/page.
10 [?b :block/marker ?marker]
11 [(contains? #{"TODO" "DOING"} ?marker)]
12]
13:inputs [:current-page]
14:result-transform (fn [result] (sort-by (fn [r] (get-in r [:block/page :block/journal-day])) result)) ; Sort by the journal date
15:table-view? false
16:breadcrumb-show? false
17:collapsed? false
18}
19#+END_QUERY