Files, paths and templates
Understand what goes in a site, how pages are resolved, and what is uploaded.
On this page
A small site directory
The root is /lantern-data/sites/<name>. Page JSON filenames keep their .json extension in links. Only / maps automatically to /index.json. A Lua handler can implement routes such as /greet without a file extension.
my-first-site/
index.json # Home page
about.json # /about.json
guides/
start.json # /guides/start.json
app.lua # Optional server handler
data/ # Local ctx.write storage; never uploadHow a request is resolved
- If app.lua exists, load it and call the returned function with ctx.
- If the handler returns a response, use it.
- If it returns nil, try the static JSON file for a GET request.
- If no matching page exists, return a not-found error. Static files do not handle POST.
Pick the right starting point
| Template | Use it for |
|---|---|
| personal | Static homepage with pixel art and columns |
| documentation | A linked handbook with a getting-started page |
| directory | A collection of links |
| fieldnotes | A two-page build journal |
| guestbook | Persistent notes submitted through a Lua form |
| showcase | Pixel art, forms, choices and masked demo input |
Hub package format
A package is a JSON object with format: 1 and a files map. Map keys are relative paths; values are file contents as strings. The downloadable templates are ready-made packages. The computer’s Upload Hub draft action builds this package for you.
{
"format": 1,
"files": {
"index.json": "{\"version\":1,\"title\":\"Hello\",\"children\":[{\"type\":\"paragraph\",\"text\":\"Hello!\"}]}"
}
}Keep paths inside the site
Use paths such as /about.json or /guides/start.json. Traversal segments (.. and .), percent escapes, backslashes, query strings, fragments and colon-bearing paths are rejected. Form actions and redirects stay within the current site.
Found a mismatch? Include the exact error, runtime version and a small example with secrets removed.