Read multiple text files from same folder (as index)

The answer is probably no, but I think there might be a trick to make it work:

I have a folder gathering all my notes, is there a way to display all these notes as separate pages even though each of them is not inside a folder?

I was thinking of possibly building a sort of index of all the txt files present in the folder and turn it into a json object, and then filter through that.

Also, following kirby inner working, if the above would work, each and every note should be named with the same filename? or any way to keep them sporting their own title name as filename?

What I want to do is to serve all my notes as html pages and filter through them through the browser instead of using any of the myriad applications to do that…

Let me answer this with the page constructor:

  public function __construct($parent, $dirname) {

    $this->kirby   = $parent->kirby;
    $this->site    = $parent->site;
    $this->parent  = $parent;
    $this->dirname = $dirname;
    $this->root    = $parent->root() . DS . $dirname;
    $this->depth   = $parent->depth() + 1;

    // extract the uid and num of the directory
    if(preg_match('/^([0-9]+)[\-](.*)$/', $this->dirname, $match)) {
      $this->uid = $match[2];
      $this->num = $match[1];
    } else {
      $this->num = null;
      $this->uid = $this->dirname;
    }

    // assign the uid
    $this->id = $this->uri = ltrim($parent->id() . '/' . $this->uid, '/');

  }

As you can see, a page objects expects a parent page and a folder name.

Edit: What you could probably try to do is use a route that then reads a textfile with the name of endpoint and returns it as a data array to a template.

thanks (:

will look into other ways to accomplish that.

See my edited remark.