> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bytesell.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Pages and routing

> Route resolution, dynamic routes, special pages, and reserved prefixes.

A `.slurp` file in `pages/` is a route. There is no route configuration.

## Route resolution

Three passes, in order. The first match wins.

<Steps>
  <Step title="Exact">
    `/products` matches `pages/products.slurp`.
  </Step>

  <Step title="Index">
    `/foo` matches `pages/foo/index.slurp`.
  </Step>

  <Step title="Bracket parameters">
    `/products/abc` matches `pages/products/[slug].slurp`, binding `slug` to
    `abc`. Segment counts must be equal.
  </Step>
</Steps>

`/` resolves to `index`.

<Warning>
  Ambiguous bracket routes resolve unpredictably. Where two `[param]` routes at
  the same depth can both match a URL there is no specificity rule and no
  tie-break, and a literal segment does not take precedence over a parameter.
  Do not define routes where more than one can match the same URL.
</Warning>

## Route parameters

A parameter is available under two names:

```slurp pages/products/[slug].slurp theme={null}
${ params.slug }
${ slug }
```

Both hold the same value. The bare name is injected at the top level and cannot
overwrite `storefront`, `theme` or `params`.

<Note>
  A page declaring `props { slug }` reads the bare `${ slug }`, not
  `${ params.slug }`. Page props are not bound from `params`.
</Note>

## Special pages

None are required. A theme that omits one has no page at that route. The
platform applies the following behaviour when they are present.

| Page                    | Behaviour                                                                    |
| ----------------------- | ---------------------------------------------------------------------------- |
| `index`                 | `/`                                                                          |
| `404`                   | Rendered for any unmatched route, status 404, forced `noindex`               |
| `login`                 | Redirect target for unauthenticated buyers, as `/login?redirect=<path>`      |
| `account`, `account/**` | Requires authentication. No declaration needed.                              |
| `account/locked`        | If present, substituted for any `/account*` URL when the buyer is restricted |
| `products/[slug]`       | Receives `og:type=product` and Product JSON-LD                               |
| `cart`                  | Conventional, not special. A theme can sell without one.                     |

`404`, `login`, `cart`, `checkout` and `redeem` are excluded from the sitemap.

<Note>
  The `404` page renders only for navigations that accept HTML. A missing
  subresource receives a plain-text response, so one bad asset URL cannot
  trigger a full page render. It shares the remaining render budget and degrades
  to plain text rather than failing.
</Note>

## Authentication

Pages under `account` require a signed-in buyer by convention. Authentication
can also be set per page in the builder.

Authentication requires a valid, signed, unexpired token. Cookie presence is not
sufficient, so the signed-in state cannot be previewed by setting one.

## Reserved prefixes

The router matches these before theme pages. A page at one of these paths is
unreachable.

```
/api/*        /auth/*       /checkout/*   /sentinel/*
/_bs/*        /assets/*     /editor/*     /a/{code}
/robots.txt   /sitemap.xml  /bs.js
```

## Default content

A page places `{sections}`. The content comes from the merchant, starting from a
matching file in `templates/`, keyed by the page key the router produced.

| Page file                     | Page key          | Defaults file                    |
| ----------------------------- | ----------------- | -------------------------------- |
| `pages/index.slurp`           | `index`           | `templates/index.json`           |
| `pages/products/[slug].slurp` | `products/[slug]` | `templates/products/[slug].json` |

See [Sections and blocks](/themes/sections).

## The head

The theme emits `<title>` and `meta description`. The platform injects
`canonical`, `og:*`, `twitter:*`, robots and JSON-LD after the template renders.

<Warning>
  A theme that emits its own `og:*` or `canonical` tags produces duplicates on
  every page.
</Warning>
