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.