How to link to pages from custom view fn?

Hello folks. I am new to logseq (started this week), and I’m very excited about it. I have a question to which I couldn’t find an answer otherwise: I’m trying to make a reading list which organizes the things I’ve already read and my notes about it, as well as showing me what I haven’t read yet. I’m using block properties to attach the read status (true or false), tags and other info.

I started by using the queries {{query (property read true)}} and {{query (property read false)}} to create these views in a separate page, but the query result items are too large (i.e. have too much information), and since I know some Clojure I decided to try making a custom query with a :view option. All I wanted was a link to the logseq page and a link to the actual article (if any), but I can’t seem to be able to link to the pages (using a link to /page/<page-name> like I’ve seen in some examples on the internet). At first, I thought it might have something to do with the fact that some of them have whitespaces in the title, but even pages without whitespace fail, and when I click what supposedly would take me to the page I get a dialog asking if I wish to reload Logseq. What am I missing?

Here is the query I used:

#+BEGIN_QUERY
{:title "Unread items"
 :query [:find (pull ?p [*])
         :where [?p :block/properties ?prop]
                [(get ?prop :read) ?read]
                [(= false ?read)]]
 :view
 (fn [results]
   [:div
    (for [{:block/keys [name original-name properties]} results]
      [:div.color-level.px-7.py-2.my-2
       [:h4
        [:a {:href (str "/page/" name)}
            original-name]]
       [:a.external-link {:href (:link properties)
                          :target "_blank"}
                         "Link"]])])}
#+END_QUERY

I was looking as well to custom view. And I faced the same issue.

It looks like it is more a problem on Logseq than on your implementation. Probably got broken after some changes.

The reason which make me think this way is that if you copy the example from https://logseq.github.io/#/page/61b36d84-38e6-4ea5-9f28-40c670b42939 you get the same issue.

PS: While I was writting this I realize that the link looks like “#/pages/blah” instead of “/pages/blah”. So the solution is to change

[:a {:href (str "/page/" name)}

to

[:a {:href (str "#/page/" name)}

I hope this will work for you too.