Tagging URL --> Summary Page

I’ve looked a bit closer, here’s a page method:

You can pass a field as parameter. If you don’t, the raw content is used.

page::$methods['getTaggedLinklist'] = function($page, $field = null) {
  if(!is_null($field) && in_array($field, $page->content()->fields())) {
    $raw = $page->{$field}();
  } else {
    $raw = $page->content()->raw();
  }
  // find all tags
  preg_match_all('!(?=[^\]])\([a-z0-9_-]+:.*?\)!', $raw, $matches);
  $list = [];
  if(count($matches[0]) > 0) {
    // loop through the matches
    foreach($matches[0] as $match) {
      // remove the brackets
      $tag  = trim(rtrim(ltrim($match, '('), ')'));
      // get the name of the tag
      $name = trim(substr($tag, 0, strpos($tag, ':')));
      // check if it is a link tag
      if($name === 'link') {
        // create a new Kirbytag instance
        $tag = new Kirbytag(null, $name, $tag);
        // make sure the tag attr is present
        if(!is_null($tag->attr('tag'))) {
          // get all attributes we need from the tag and add to list array
           $list[] = [
             'link' => $tag->attr('link'),
             'tag' => $tag->attr('tag'),
             'text' => $tag->attr('text')
           ];
        }
      }
    }
  }
  return $list;

};

dump($page->getTaggedLinklist());

Note: this method requires a modified link kirbytag with a tag attribute. However, similar code can be quite useful for other use cases as well. You could also make this a pages method (with some modifications) or use the code inside.