Or you can read the files in a template, like the approach I describe here: Virtual pages from static HTML files (or something like that)
Or a modified concept:
content/
html-examples/
html-examples.txt
Then a route:
[
'pattern' => 'html-examples/(:any)',
'action' => function ($file) {
$data = [
'filename' => $file
];
return page('html-examples')->render($data);
}
],
html-examples.php controller
<?php
return function ($page, $filename) {
return [
'filename' => $filename
];
};
html-examples.php template
<?php
echo F::read($kirby->root('index'). '/'. $filename);
So when you call http://yourdomain.com/html-examples/test.html
, it would read the test.html
file from the root folder (or another given folder, where you store the examples).
In textfile, create link like this:
(link: html-examples/test.html)