How can I refer to the "current page" in a template?

I’m creating a template that includes a simple query.
In this query I want to find projects that have as a parent (property) the current page.
Currently, every time I use the template, I have to remember to update the reference to the current page, but is there a way to have a template replace a value with the current page automatically?

Here’s a simplified view of the query:

{{query (and (property :type "project") (property :parent {{current_page}}))}}

I want {{current_page}} to be replaced by the page I used the template in.

Thanks :pray:

Welcome to the community @DiogoSnows! :wave:

{{current_page}} isn’t valid syntax. The syntax for dynamic variables is: <% current week %> (anything between <% and %> gets interpreted by the natural language processor in Logseq).

Also, it seems like you’re trying to mix simple queries with datalog (:type, :parent) which isn’t supported. See this query lesson (and the other lessons in the series) on how to properly write simple queries using dynamic variables.

Thanks @Ramses ! :pray: Appreciated

Maybe I’m calling them the wrong thing? I assumed it was the simple query as I built it with the UI

I am using <%current page%> in some of my templates.
When inserting the template, it gets replaced with the actual page name.

However, this will obviously not survive page renaming.

I believe that if the page (not the link) is renamed, logseq renames it on all places where it is referenced/linked to as well.

1 Like

Oh, you are right! I din’t realize that the pagename inside a query also is inside double-brackets

1 Like

Ah yes, I see now that the live query builder indeed inserts :type and :parent. My bad, just ignore that part of my reply.

In any case <% current week %> is the correct syntax for the dynamic variables.