Hi,
I'd like to add a query to my journal template about which files have been modified on this (journal) day, or create a new template, no problem.
Need help with the query.
Thanks.
Hi,
I'd like to add a query to my journal template about which files have been modified on this (journal) day, or create a new template, no problem.
Need help with the query.
Thanks.
Maybe another considerable (better?) approach is to add a top/bottom widget (or even one of the new "dockable views"), which applies only to your journal pages? That way you don't need to change the template.
See Widget
Just a raw exampe:
```space-lua
-- priority: -11
event.listen {
name = "hooks:renderBottomWidgets",
run = function(e)
if not editor.getCurrentPage():startsWith("Journal/") then
return
end
local changeslist = query[[
from index.tag "page"
limit 10
order by lastModified desc
]]
if #changeslist >0 then
return "# Last 10 changes:\n" .. markdown.objectsToTable(changeslist)
end
end
}
```
Great!,
How could I change the query to show pages where "lastModified" is equal to Journal "date" at the frontmatter(?).
Thanks.
You can get the "date" from the frontmatter with editor.getCurrentPageMeta().date
To get the lastModified date, you need to chop of the time indication, for instance string.sub(editor.getCurrentPageMeta().lastModified,1,10)
Then the query is something like:
${query[[ from p = index.contentPages() where string.sub(p.lastModified,1,10) == editor.getCurrentPageMeta().date ]]}
You made my SB better! ![]()
Thanks!.