Can I include the current page name in a larger string in a query?

Continuing the discussion from Working on a general approach to share a CV / Resume in Logseq:

It seems like a sensible way to make something like blog posts would be to include a similarly-named page in a namespace hierarchy. So, for example, if you have the journal page for 2022_09_07, I could make a Blog page called Blog/2022_09_07. I want to add this to my config.edn :default-queries, so I’m trying an advanced query:

#+BEGIN_QUERY
{:title "Blog"
 :query          [:find (pull ?b [*])
                       :in $ ?curr
                       :where
                       [(page ?b (str "Blog/" ?curr))]
 :inputs           [:current-page]
 :collapsed?       false}
#+END_QUERY

But a simple query like this also doesn’t work: {{query [[Blog/<% current page %>]]}} - which makes sense, as I know that expands to the LINK, not just the name string. I’m guessing maybe that’s happening in the above query as well. I will note that a very simple {{query <% current page %>}} returns a bunch of pages I don’t expect.

So, I’m wondering if there’s any way I can compose the name of the current page into a larger name?

Making some progress - using the inspector/developer tools I could see some of the errors I was getting, and I dialed all the way back to this extremely simple query (there is no :where clause!) to understand what’s passed in as the :current-page:

#+BEGIN_QUERY
{:title "Blog"
 :query          [:find ?curr
                       :in $ ?curr
                      ]
 :inputs           [:current-page]
 :view        (fn [results]
                    [:div (count results)
                      [:ul
                      (for [n results]
                        [:li (pr-str (type n)) " :: " (pr-str n)]) ]])
 :collapsed?       false}
#+END_QUERY

You can verify this by copying the above into a block on a journal page: :current-page passes in a string for the date of the journal page. This is in a format like “sep 9th, 2022” [lowercase “sep” is in the result].

So, I renamed my blog page to “Blog/sep 9th, 2022”, and tried with the following query:

#+BEGIN_QUERY
{:title "Blog"
 :query          [:find (pull ?p [*])
                       :in $ ?curr
                       :where
                       [?p :block/name ?name]
                       [(clojure.string/ends-with? ?curr ?name)]
                      ]
 :inputs           [:current-page]
 :collapsed?       false}
#+END_QUERY

The journal page shows up (as does the “2022” block), but the blog still doesn’t appear.

I’m guessing this may be due to issues with querying from a journal page? (I remember reading something about this, but can’t find it now).

Anyway, I’m going to create my desired links manually for now, and will keep up the slow-burn learning with this particular issue. I’ll return to @Ramses’ excellent learning series for now to make sure I’m not missing an easier approach.