I do something similar with a widget (my notes are tagged with #quick-note rather than #memo). I like the widget method so I can maintain the content from one location. As opposed to yours, this version also shows only the first line of the quick note as a snippet since I'm still using the main Journal page for content.
function markdown.extractSnippet(content)
content = index.extractFrontmatter(content, {removeFrontMatterSection=true}).text
return string.split(string.trim(content), "\n")[1]
end
templates.fullPageItemSnippet = template.new[=[- [[${ref}|${ref}]]
- "${markdown.extractSnippet(space.readPage(ref))}"
]=]
function widgets.linkedQuickNotes(date)
local notes = query[[from p = index.tag "quick-note" where p.tag == "page" and p.date == date]]
if some(notes) then
return widget.markdownBlock("# Linked Quick Notes\n" .. template.each(notes, templates.fullPageItemSnippet))
end
end
event.listen {
name = "hooks:renderBottomWidgets",
run = function(e)
local page = editor.getCurrentPage()
local meta = editor.getCurrentPageMeta()
if not page or not meta then
return
end
if table.includes(meta.tags, "journal") and meta.date then
return widgets.linkedQuickNotes(meta.date)
end
end
}