Accessing transclusion parent page in queries

I have a daily journal template and rather than update every journal page whenever I make a change to the queries, I’m experimenting with including the queries by transclusion.

However, I’ve noticed that _CTX.currentPage.name doesn’t inherit the page name of the calling page. My use case is to show incomplete tasks except any listed on the current (journal) page.

Is there another way I can do this or should I raise a feature request in GitHub?

I think editor.getCurrentPage() should always give you the “root” page (page open in the editor)? So this should roughly do what you hope for?

It does indeed, thank you!

1 Like

Not sure if this is a bug or desired behaviour but I don’t think editor.getCurrentPage() is accessible in online mode (in edge).

I was trying to debug this last night to no avail until I randomly clicked the mode button which put me into Sync mode and my transcluded query worked again.

I think I read that online mode is disappearing in v2 so I’m not bothered about this being fixed but wanted to point it out :slight_smile:

That’s right. In Online mode SB will try to offload as much template rendering to the server, and on the server the editor.* syscalls are not available (for perhaps obvious reasons). This split will indeed go away with Online mode in v2, which is another side-benefit of this simplification.

1 Like