Fetch pages from plugin

I want to create a KirbyTag that will display my “Notes feed” when someone writes (notes: count:8) in a textarea. I have created two blueprints for Notes and Note and my plugin html currently looks like this:

   'html' => function($tag) {
      $html = '<div id="notes-feed" class="notes-wrapper">';

         // here goes feed

      $html .= '</div>';
      
      return $html;
   }

My question: How can I fetch/query all Note pages and loop through in the plugin? I’m open for other solutions if this seems like the wrong way to solve it.

Please note that I have to be able to use the KirbyTag on all pages, that might not be related to Notes/Note as parent/child.

Thanks/N

With site()->find('notes')->children() or using the page helper page('notes')->children() you can access these pages from anywhere.

Instead of putting the HTML into the tag, you can use a snippet.

Thanks, that worked a charm!