Module

pages

Filesystem-based routing with automatic layout nesting.

Combines co-located routes and templates, automatic layout composition, and htmx-header-driven rendering depth. Thepages/directory structure defines URL paths, layout nesting, and context inheritance.

Usage::

app = App(AppConfig(template_dir="pages"))
app.mount_pages("pages")
app.run()

Conventions:

pages/
  _layout.html       # Root layout (target: body)
  _context.py        # Root context provider
  documents/
    page.py          # GET /documents
    {doc_id}/
      _layout.html   # Nested layout (target: app-content)
      _context.py    # Context: loads doc
      page.py        # GET /documents/{doc_id}
      edit.py        # POST /documents/{doc_id}/edit