# Static sites

A build output is a complete site — served by the host, no server code involved.

A release that ships assets and no server code is a complete **site**. The
host serves it entirely; no isolate exists, no cold start can happen, and
nothing about it is a degraded "app without a backend". React, Astro, Vue,
Svelte, plain HTML — build output deploys as-is.

```json
{
  "name": "my-site",
  "auth": "public",
  "assets": "dist"
}
```

## How requests resolve

Every request walks the same three steps:

1. **Asset.** If the path matches a file in the release, the host serves it.
   Directory paths resolve their index (`/pricing/` → `/pricing/index.html`),
   with or without the trailing slash. Without the slash, a path also finds
   its `.html` file when there is no index (`/pricing` → `/pricing.html`), the
   layout Next.js's static export and SvelteKit's adapter-static write by
   default. `/pricing/` never serves `pricing.html`: its relative links would
   resolve against a directory it is not in.
2. **Declared route.** If the app ships [server functions](/hosting/server-functions.md),
   a path matching a declared route starts an isolate. A pure static site has
   none.
3. **Fallback.** Everything else gets the fallback.

## The fallback

What an unmatched path gets is declared in the manifest:

| `fallback` | Behavior |
| --- | --- |
| absent | Your build's `404.html` with a real 404 status (a plain 404 if the build shipped none) |
| `"404"` | The same, made explicit |
| `"spa"` | `index.html` with a 200 — for client-side routers, where the path is the router's input, not a missing file |

`"spa"` never swallows declared routes: the route step runs before the
fallback, which is exactly why the routes list exists.

## Markdown for agents

A page can answer as Markdown on its own URL. Write a `.md` file next to
the page's HTML in your build output, and a client that asks for Markdown
gets it:

| Page | Markdown alternate |
| --- | --- |
| `index.html` | `index.md` |
| `guide/index.html` | `guide.md` |
| `guide.html` | `guide.md` |

```sh
curl -H 'Accept: text/markdown' https://my-site.pilvia.app/guide/
```

Only a client that names `text/markdown` in its `Accept` header, and ranks
it at least as high as `text/html`, gets the Markdown. AI agents such as
Claude Code send `Accept: text/markdown, text/html, */*`. Browsers,
crawlers and `curl` without the header never name it, so they keep getting
HTML. There is nothing to configure: the `.md` file is the declaration, the
way `404.html` is.

Both answers for such a page say what they are:

- `vary: accept-encoding, accept` tells caches that the answer depends on
  the request's `Accept`.
- `link` points at the other representation: `rel="alternate"` from the
  HTML to the Markdown, `rel="canonical"` from the Markdown to the page.
  The canonical link is also on the `.md` when it is fetched by its own
  name, so a search engine that finds it counts it as the page.

Each representation keeps its own ETag. A page with no `.md` next to it
keeps exactly the headers it had, and the [fallback](#the-fallback)
always answers HTML.

> [!WARNING]
> **Behind Cloudflare's proxy**
>
> Cloudflare's cache ignores `Accept` in `vary`. If your custom domain is
> proxied through Cloudflare and a rule caches HTML ("Cache Everything"),
> Cloudflare can serve the Markdown to a browser or the HTML to an agent. By
> default Cloudflare caches neither HTML nor `.md`, so this only matters with
> such a rule. Either leave HTML uncached there, or link agents to the `.md`
> URLs, which need no negotiation.

## What the host does for you

- **Honest caching** — every asset carries its content hash as a strong
  ETag; hashed bundler output is immutable for a year. The policy is
  readable in the response headers. See [Caching](/hosting/caching.md).
- **Compression** — responses are compressed with brotli, zstd or gzip,
  negotiated per request; already-compressed formats and tiny bodies are
  left alone.
- **TLS** — `<name>.pilvia.app` is certified out of the box, custom domains
  get on-demand certificates. A TLS 1.3 client that offers the post-quantum
  hybrid key exchange X25519MLKEM768 gets it; any other gets X25519 or an
  elliptic curve. See [Custom domains](/hosting/custom-domains.md).

Nothing on this page requires configuration beyond the three-line manifest
above. The rest of the Hosting section is for sites that need more.
