How to approach a fake/virtual/programmatic page

Hi,

I’m wondering what’s the best practice approach to programmatically render a fake/virtual “page” that doesn’t exist as a content page in my directories. (Not sure if this is the right terminology here)

I have my projects setup like this.

projects/
   1_project/
   2_project/
   3_project/
   ...

I know how to get all projects and render them as a list on my projects page or a gallery and it’s corresponding page, if those table and gallery templates correspond with a say table or gallery content page in the panel. In the past i just created a template and a content page for each and had snippets iterate over each project in different ways on them.

But I want to display my projects in a bunch of ways (gallery, table, filtered) without these pages cluttering up the panel for the editor, since they can’t do anything on them anyways.

I only need pages in my panel that are editable for an editor and would like to not display anything else.

So I’m just wondering what’s the best practice to do this, hide pages in the panel somehow, or not have them in the first place?

I’ve looked at routes, collections, virtual pages, models and but feel like I’m missing something fundamental.

in my config i did this which just gives me a 404

'routes' => [
    [
        'pattern' => 'projects/gallery',
        'action'  => function () {
            return kirby()->render('progallery');
        }
    ]
]

Thanks a lot!

Wouldn’t using a parameter make more sense, then use different snippets based on parameter?

Or if you prefer a routing scheme over parameters, pass the variable to the controller, then act based on that: Controllers | Kirby CMS

I’d prefer to have simple urls like

Maybe the most straightforward is to just hide certain page templates in the panel?

options:
   access: false 

Or would urls like this be possible too with routing and parameters?

Yes, of course, you just have to differentiate between real (i.e. pages in the content folder), and such routes that return a given page with different options.

ah ok, well the idea was to not have real pages in the content folder—for a gallery of the projects for example, since i would hide it in the panel anyways.