Hi, this is my first post here, open to feedback ![]()
I’m trying to achieve something that would seem simple, but I struggle with.
On any journal page, I’d like to use a template for tasks that are scheduled or deadline for the current page date.
I’m not talking about “today” but really the date of the page that will host the query.
Let’s say I want to setup the page for next tuesday, which is 2025-12-09 at the time of writing. For the test I’m going to add a test TODO with this scheduled date in the page, but of course this is not what would happen usually. What I’m interested in is really the scheduled date for that task, not the block it belongs to.
- If I set the date explicitly in my query,
#+BEGIN_QUERY
{
:breadcrumb-show? false
:group-by-page? false
:query [:find (pull ?b [*])
:in $ ?day
:where
[?b :block/marker ?m]
[(contains? #{"TODO" "DOING"} ?m)]
(or
[?b :block/scheduled ?day]
[?b :block/deadline ?day]
)
]
:inputs [20251209] ;<---- hard coded date
}
#+END_QUERY
This works as expected.
But I don’t want to need to change the date every time!
I want to have the date injected automatically by the plugin. I’ve used the <% current page %> many times already with success, but can’t manage to provide it as input of this query. I’ve tried different syntaxes but most of them don’t work.
This seems to be valid syntax, but still no task are extracted, I suspect this is because I get a link to the page and not its date:
:inputs ["<% current page %>"]
So I guess one way to solve this would be to extract the journal day from the input page link, which is something I’ve seen in some examples, but can’t manage to reproduce here.
Would someone be able to help me do the transformation from “journal page” to “proper date”?
Final note: I already use a template per week, stored in Weeks page, in which I set some planning for each “next week day”. This week template uses the macros <% next monday %> <% next tuesday %> etc.
This is working fine and I use it then via another day template to target the specific day of the week with something like:
{{query (and <% current page %> [[Weeks]] )}}
So, I also tried alternatives to the “day” query with things like <% next tuesday %>, but with no more luck (I’m quite sure this is the exact same problem as the <% current page %> macro: these are both page links, not dates)
Thanks for reading!
