Embeding content of the pages in an index page

I was trying to store venue list in my Silverbullet.
Idea I have is to store every venue as a separate page with frontmatter handling metadata, like link, addresses, coordinates, and content of the page being notes or reviews.

I had a challenge in including content of the other pages in the main one.
Here’s my solution to this challenge:

${template.each(
query[[
  from index.tag "page" 
 where table.includes(tags, "Venue")
 select {
   name = _.name,
   ref = _.ref,
   content = index.extractFrontmatter(space.readPage(name), {
     removeFrontMatterSection = true,
     removeTags = true
   }).text
}]],
template.new [==[- [[${ref}]] ${content}
]==])}

This query gets list of pages and puts into field content actual text of each page (excluding frontmatter and tags).

2 Likes