Return a partial HTML response, a status code, or a file from disk.
| Kind | Attribute |
| Since | 0.1.0 |
respond [fragment <selector> | status <code> | file <path> [as <name>] [inline|attachment]]
Three forms:
- Without arguments: renders the body's HTML normally.
fragment <selector>: returns an htmx swap.status <code>: returns an explicit HTTP status.file <path> [as <name>] [inline | attachment]: streams a disk file.<path>accepts:paramsubstitution. Default disposition isattachment;as <name>overrides thefilename=portion ofContent-Disposition. Requiresserve-rootsin theconfigblock listing allowed directories.
action /users/:id/toggle method POST
query: UPDATE user SET active = NOT active WHERE id = :id
respond fragment ".user-row" query: SELECT * FROM user WHERE id = :id
action get /review/:id/pdf
query: SELECT pdf_path FROM review_job WHERE id = :id
respond file :pdf_path as relatorio.pdf
| Spec last touched | 18cf488 (2026-05-20) |
| Source last touched | af278bb (2026-05-20) |
| Source files | internal/parser/parser.go |