How to render a page of linkable quotes?

If one wanted to freely use a tag like quote throughout the body of ones notes, not at the page level, but only at the paragraph and item level, then what might be an easy way to generate a Quotes page that lists all quotes with links back to their original locations?

For instance, Let’s say we have the following:

Page A

A paragraph that contains “an interesting quote” #quote

And we have:

Page B

A page with some list items

  • Item 1
  • Item 2 - which contains “another interesting quote” #quote
  • Item 3

And now we want a Quotes page that essentially looks like this:

  • [[Page A@123]] A paragraph that contains “an interesting quote”
  • [[Page B@456]] Item 2 - which contains “another interesting quote”

I can see how we might do that rendering paragraphs like * {{ref}} {{text}}. And likewise how we might do it for items like * {{ref}} {{name}})

But is there a way to create a render template that is smart enough to know if the item being rendered is a paragraph OR an item and then outputs the proper template syntax?

Thank you!

-Grace

Actually I figured it out. I made a function that accepts paragraph objects and item objects which then merges them and orders by ref. Then I can simply call the function passing in the paragraphs and items containing quotes and get back a single object containing all references, which can then be iterated over for display. The Template Language (silverbullet.md) gave me what I needed.

1 Like