Simulate that there is a content file

Is there any way that I can simulate that there is a matching content file? I have done a simple analytics function but it’s not so easy that in my data folder there must be also the template content.

Example (my template is called analytics.php)

2020-02-01.txt
2020-02-02.txt
2020-02-03.txt
...
...
...
analytics.txt

So, it’s a bit complicated cause I must always exclude the analytics.txt when looping through the data. Can I simulate that there is a content file? Otherwise always the default template comes into play …

You can create a virtual page in a route, or register a page via a plugin.

Seems to work, but however, the page is password protected and when I do a POST or GET Request the virtual page is broken?

Which approach did you try?

The virtual page …

GET is working, POST not. Can this happen cause of the Form action? Of course, there is still a folder called analytics, maybe this conflicts with the virtual page?

By default, routes only work for GET request, you can however allow other methods using the method property: https://getkirby.com/docs/guide/routing#methods

That does the trick :slight_smile: