d4l-data4life / kirby3-static-site-generator

Static site generator plugin for Kirby 3+. With this plugin you can create a directory with assets, media and static html files generated from your pages. The result is an even faster site with less potential vulnerabilities.
MIT License
137 stars 7 forks source link

Generate path as .html with custom routes #61

Closed cvholten closed 2 years ago

cvholten commented 2 years ago

Hi there,

is it possible to get path names as .html files like "/projects/project-a.html" instead of "/projects/project-a/index.html". The new feature for custom routes looks interesting and I would like to know if it is useful for the described result from above?

Or do you know any other way get .html for all links in static version?

jonathan-reisdorf commented 2 years ago

Hi rs-vonholten, custom routes would work (iterating over all pages in Kirby's ready option and generating routes from them with .html), but then the pages are generated right next to the routes (so, there would be two urls for every page) - to avoid this, you'd have to manually pass in an empty set of pages to be generated. The cleanest way (untested) imo would be to use page models and then override the url method so that .html is appended, but there might be other ways.