Recursively search for tasks that are tagged or have their parent tagged with current page.
Combining “Tasks by current page & it’s aliases” with the recursive search from “Tasks that don’t reference a page regardless of nesting”
#+BEGIN_QUERY
{:title ["Query by page & alias"]
:query [:find (pull ?b [*])
:in $ ?page %
:where
[?b :block/marker "TODO"]
[?p :block/name ?page]
(or-join [?b ?p]
(check-ref ?p ?b)
(and
[?p :block/alias ?a]
(check-ref ?a ?b)
)
)
]
:rules [
[(check-ref ?p ?b)
[?b :block/refs ?p]
]
[(check-ref ?p ?b)
[?b :block/parent ?t]
(check-ref ?p ?t)
]
]
:table-view? false
:inputs [:current-page]
}
#+END_QUERY
Sample result: