How do I query the first TODO in pages with given tag?

I have many pages with mytag on them. I would like to list all tasks from these pages, but I only want the first task of a given page. When I get it done, the next one should appear in the query result. This is what I got so far

{:title "First task on on pages with tag MYTAG"
 :query [:find (pull ?b [*])
           [?b :block/marker ?marker]
           [(= "TODO" ?marker)]
           [?b :block/page ?p]
           [?p :block/tags [:block/name "mytag"]]
 :view (fn [result]
         (for [x (reduce-kv (fn [m k v]
                              (assoc m k [(first v)]))
                            {} result)]

I am filtering the first task in the view (I don’t know if there is a way to do that on the query. But I couldn’t find a way to render the items nicely as I could have not using views (i.e. default way to render).


  1. Is there a way to limit the first result as part of the query?
  2. If (1) is not possible, how do I use the default renderer in the view function?