> ## 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.

# Template globals

> Template globals by scope, with their shapes.

## By scope

| Global              | Page | Section | Block | Component / layout |
| ------------------- | ---- | ------- | ----- | ------------------ |
| `storefront`        | yes  | yes     | yes   | yes                |
| `theme.settings`    | yes  | yes     | yes   | yes                |
| `platform`          | yes  | yes     | yes   | yes                |
| `page_seo`          | yes  | yes     | yes   | yes                |
| `params`, `<param>` | yes  | yes     | yes   | yes                |
| `section`           | no   | yes     | yes   | no                 |
| `block`             | no   | no      | yes   | no                 |
| `{sections}`        | yes  | no      | no    | **no**             |
| `{sections "name"}` | yes  | no      | no    | yes                |

The last two rows differ. The page's own section list is removed on entry to a
component or layout, so a stray `{sections}` cannot duplicate the page. Named
groups are retained, so a layout can compose the header and footer.

Props passed to a component take precedence over a global of the same name.

## `storefront`

The complete object. It contains no `products`, `cart` or `user`.

| Field                    | Type                              |
| ------------------------ | --------------------------------- |
| `id`                     | uuid                              |
| `slug`                   | string                            |
| `name`                   | string                            |
| `description`            | string, null                      |
| `currency`               | string                            |
| `presentment_rates`      | object of currency to rate string |
| `presentment_rates_json` | string                            |
| `logo_url`               | string                            |
| `auth_app_id`            | uuid, null                        |
| `auth_service_url`       | string                            |
| `theme_rev`              | int, null                         |
| `remove_branding`        | bool                              |
| `oauth_providers`        | string\[]                         |
| `oauth_google`           | bool                              |
| `oauth_github`           | bool                              |

`presentment_rates_json` duplicates `presentment_rates` because Slurp has no
`json` filter. `oauth_google` and `oauth_github` duplicate `oauth_providers`
because `{if}` cannot test array membership.

## `section`

```json theme={null}
{
  "id": "hero",
  "type": "Hero",
  "settings": { "heading": "..." },
  "blocks": [
    { "id": "b1", "type": "link", "settings": {}, "blocks": [] }
  ]
}
```

`settings` and `blocks` are always present, including on a leaf block. `id` and
`type` are present only when they pass the identifier check. Guard them before
printing.

Values in `settings` have already been merged against the schema: unknown keys
dropped, numbers clamped to `min` and `max`, `richtext` sanitized, invalid
colours and links replaced by the default.

<Warning>
  A section template with no `section { }` schema receives the merchant's raw
  saved state, with string values sanitized but nothing else validated. Declare
  a schema.
</Warning>

## `block`

The same shape as a section's block entries. In a block template, `section`
resolves outward to the enclosing section.

## `theme.settings`

Values from `config/settings_schema.json` merged with the merchant's saved
values. Saved values take precedence. Keys the schema does not declare are
retained, which is the opposite of section settings behaviour.

## `page_seo`

Either `{}` or:

```json theme={null}
{ "title": "...", "description": "...", "social_image": "...", "noindex": false }
```

Always present, so `${ page_seo.title ?? theme.settings.default_title }` is safe.

## `params`

Route parameters as strings. Each is also injected at the top level, where it
cannot overwrite `storefront`, `theme` or `params`.

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

A page declaring `props { slug }` reads the bare form.

## `platform`

See [Platform assets](/themes/reference/platform).
