KScript docs
EN

Web pages

Routing

The file a URL serves comes from its path. /people serves people.html, people.md or people/index.html. A folder or file name in brackets matches any value, so /people/42 can match people/[id].html, where the value is $request.params.id.

Files and folders whose names start with _ or ., and KScript sources (.kscript, .ks.xml and any other .xml), are never served. _404.html is used for missing pages, and may use layouts, components and live blocks like any page.

Pictures, fonts and other files that never change can live in a folder of their own: set "public": "public" in the serve section of kscript.json, and public/brand/logo.png is served at /brand/logo.png. The folder is relative to kscript.json, so it may sit beside the site folder rather than in it. A file in the site folder wins over one with the same address in the public folder, and nothing in the public folder is run as a page: an .html file there is sent as it is.

Every file is sent with Last-Modified and an ETag, so a browser that already has it asks whether it changed and gets 304 Not Modified, with no body, when it hasn't.