@page.name in template

How do I get the name of the page that is currently being created inside a template page?

editor.currentPage only returns the page name that I had open when executing the „Page: From Template“ command.

This is not possible right now afaik.
It would be possible to add though. The template.new function already accepts extra environment args. Should be a very easy pull request if you want to add it :eyes:

@gorootde How are you using this/want to use this? I have this working on my template and am curious in what setting it doesn’t work?

FWIW, one hack I’ve used for some trickier commands in templates is to:
${"$"}${generateLua()}

Where generateLua literally outputs Lua code I want to execute, e.g.:

function generateLua()
    return '{editor.getCurrentPage()}'
end
2 Likes