Advanced query for pages with a tag

It was back in 2022 and still the docs misinform? Or is it that we’re doing something wrong?

https://docs.logseq.com/#/page/66053e49-889d-4daf-89af-9e7721a7a8ea

#+BEGIN_QUERY
{:title "All pages have a *programming* tag"
 :query [:find ?name
       :in $ ?tag
       :where
       [?t :block/name ?tag]
       [?p :block/tags ?t]
       [?p :block/name ?name]]
 :inputs ["programming"]
 :view (fn [result]
       [:div.flex.flex-col
        (for [page result]
          [:a {:href (str "#/page/" page)} (clojure.string/capitalize page)])])}
#+END_QUERY

So this query refers to some “block/tags” property which doesn’t exist neither on a page nor on a block.

If first block on a page is used to set page properties then why putting #aTag there doesn’t add anything to the page block?

For example, I have a page like:

I’d expect to see my #r/video tag somewhere but page contains just these:

{:block/uuid #uuid "6619c371-2a99-4704-8188-9d6970dccd31",
 :block/journal? false,
 :block/namespace {:db/id 938},
 :block/updated-at 1712965981724,
 :block/created-at 1712958278591,
 :db/id 937,
 :block/name "r/video/bianca - linked knowledge does not work - 2023",
 :block/file {:db/id 1005},
 :block/original-name
 "r/video/Bianca - Linked Knowledge Does Not Work - 2023"}

As you see, there are no properties, nor tags. So how to query pages with a certain tag?

1 Like