nate34k
(Nathan Kraft)
April 18, 2025, 3:06am
21
Sounds good. I figured out a nice way to do it.
Follow up question. Is there a way to retain the query in a page template? When I make a new page from this template:
---
command: "Journal: Daily Note"
suggestedName: "Journal/Daily/${date.today()}"
confirmName: false
frontmatter: "
parentWeek: Journal/Weekly/${date.year()}-W${date.weekNumber()}\n\
yesterday: Journal/Daily/${date.yesterday()}
"
openIfExists: true
tags: meta/template/page
---
|^|
${query[[
from p = index.tag "page"
select {
name = p.name,
modified = p.lastModified
}
limit 3
]]}
Its output is:
---
parentWeek: Journal/Weekly/2025-W16
yesterday: Journal/Daily/2025-04-16
---
{{name = CONFIG, modified = 2025-04-17T13:48:50.151}, {name = Functions/Date, modified = 2025-04-17T16:40:54.778}, {name = Journal/Daily Note, modified = 2025-04-17T18:00:33.149}}
Ideally I was hoping for a way to be able to use the page template to put a query in the page created by the template, not have it be evaluated.
zef
(Zef Hemel)
April 18, 2025, 7:41am
22
No not yet, I need to figure out how to āescapeā Lua directives. Havenāt gotten to that yet. Let me create an issue: Ability to escape Lua expression directives Ā· Issue #1343 Ā· silverbulletmd/silverbullet Ā· GitHub
vxnick
(Nick)
April 18, 2025, 8:37am
23
A potential workaround that I use (but has its own problems, described below) is to embed pages containing Lua on my daily journal template.
For example:
---
suggestedName: "Journal/${date.today()}"
confirmName: false
openIfExists: true
tags: meta/template/page
---
# Inbox
![[Library/Personal/Embeds/Inbox]]
# Notes
- |^|
# Tasks
## Incomplete
![[Library/Personal/Embeds/IncompleteTasks]]
This works except within the PWA (which I donāt use, but tried after spotting it in my browser) and previously on edge/v1 when I was in online mode - in terms of the embeds not being evaluated, I mean.
marad
(Marcin Radoszewski)
April 29, 2025, 10:58am
24
@zef @nate34k
No not yet, I need to figure out how to āescapeā Lua directives.
This is actually pretty easy to do currently! You just need to play the āmeta-gameā on the higher level
${"$"}{date.today()}
This ${"$"}
will execute while templating effectively putting it inside the rendered text. The rest is simple text that magically turns into inline query by addition of the missing ā$ā
I use this in my daily note template as so:
${"$"}{utils.getTodaysTasks()}
7 Likes
marad
(Marcin Radoszewski)
April 29, 2025, 11:02am
25
And for the frontmatter I simply put the additional frontmatter after the first one
---
tags: meta/template
description: this is the meta page frontmatter
---
---
description: this will be the frontmatter of the new note
---
...
3 Likes
zef
(Zef Hemel)
April 29, 2025, 8:07pm
27
Well obviously thatās how to do it. Do I need to spell everything out?
4 Likes