# Page types

Every page a theme renders, its JSON template, its address and the variables it receives.

<!-- Generated by `bin/console app:dev:reference` from the platform code and docs/dev/_data/. Do not edit by hand. -->

Each page type is drawn from a JSON template in `templates/`. The template lists the sections of the page; every section on the page sees the variables below. See [Templates](../themes/templates.md) for the template format.

## Global variables

Available on every page, in the layout, in every section and block.

| Variable | Type | Description |
| --- | --- | --- |
| `shop` | [`shop`](objects/shop.md) | The store. |
| `settings` | hash | Values of the theme settings (`config/settings_schema.json`), resolved. |
| `cart` | [`cart`](objects/cart.md) | An empty cart outside the cart page - pages are cached for everyone, read the live cart with `/cart.js`. |
| `template` | string | The page type, for example `product` - for a class on `<body>`. |
| `template_suffix` | string | The alternate template in use (`mask` for `product.mask.json`, `books` for `category.books.json`), null for the default one. |
| `page_title` | string | The title of the page content, without the store name. |
| `seo_title` | string | The full document title from the store's SEO templates. The platform puts it in `<title>` for you. |
| `content_for_header` | html | Layout only. Platform markup for `<head>`: meta tags, canonical, Open Graph, the section stylesheet, preconnects, scripts the merchant added. Print it in `<head>`. |
| `content_for_layout` | html | Layout only. The rendered sections of the page template. |

## index

- Template: `templates/index.json`
- Address: `/`

| Variable | Type | Description |
| --- | --- | --- |
| `products` | list of [`product`](objects/product.md) | The store's offers, as sorted and limited in the store's product settings. |
| `articles` | list of [`article`](objects/article.md) | The three latest blog posts. |
| `categories` | list of [`category`](objects/category.md) | The top-level store categories. |

## product

- Template: `templates/product.json`
- Address: `/products/<handle>/`
- Alternate templates: `product.<suffix>.json` - the merchant picks the template on the offer.

| Variable | Type | Description |
| --- | --- | --- |
| `product` | [`product`](objects/product.md) | The offer. Its `reviews` and `optionFields` are filled only here. |
| `recommendations` | list of [`product`](objects/product.md) | Up to eight offers from the same store categories, filled up with the newest. |

## category

- Template: `templates/category.json`
- Address: `/categories/<handle>/`
- Alternate templates: `category.<suffix>.json` - the merchant picks the template on the category. Subcategories keep their own choice.

| Variable | Type | Description |
| --- | --- | --- |
| `category` | [`category`](objects/category.md) | The category, with `children`, `siblings`, `filters` and the offers of this page. |
| `products` | list of [`product`](objects/product.md) | The offers of the current page. |
| `pagination` | hash | `page`, `pages`, `total` and `per_page`. |
| `sort` | string | The sort in use. |
| `sort_options` | list of string | Sorts a customer can choose: `newest`, `popularity`, `rating`, `price_asc`, `price_desc`, `name`. |

## page

- Template: `templates/page.json`
- Address: `/<path>/`
- Alternate templates: `page.<last segment of the path>.json` - `/contact-us/` uses `page.contact-us.json` when the theme has it.

| Variable | Type | Description |
| --- | --- | --- |
| `page` | [`page`](objects/page.md) | The content page. |

## blog

- Template: `templates/blog.json`
- Address: `/blog/ and /blog/<category path>/`

| Variable | Type | Description |
| --- | --- | --- |
| `blog` | [`blog`](objects/blog.md) | The blog. |
| `blog_category` | [`blog_category`](objects/blog-category.md) | The category on a category page, null on the blog home. |
| `articles` | list of [`article`](objects/article.md) | The posts of the current page. |
| `pagination` | hash | `page`, `pages`, `total` and `per_page`. |
| `sort` | string | The sort in use. |

## article

- Template: `templates/article.json`
- Address: `/blog/<handle>/`

| Variable | Type | Description |
| --- | --- | --- |
| `blog` | [`blog`](objects/blog.md) | The blog. |
| `article` | [`article`](objects/article.md) | The post. |
| `articles` | list of [`article`](objects/article.md) | Related posts. |
| `previous_article` | [`article`](objects/article.md) | The older neighbour, null for the first post. |
| `next_article` | [`article`](objects/article.md) | The newer neighbour, null for the latest post. |

## terms

- Template: `templates/terms.json`
- Address: `/<feature page>/`
- Alternate templates: `terms.<feature code>.json` - for example `terms.authors.json`.

| Variable | Type | Description |
| --- | --- | --- |
| `feature` | [`feature`](objects/feature.md) | The feature index - values, alphabet, search and pagination. |

## term

- Template: `templates/term.json`
- Address: `/<feature prefix>/<handle>/`
- Alternate templates: `term.<feature code>.json`.

| Variable | Type | Description |
| --- | --- | --- |
| `term` | [`term`](objects/term.md) | The value with its offers and listing filters. |
| `pagination` | hash | `page`, `pages`, `total` and `per_page`. |
| `sort` | string | The sort in use. |

## search

- Template: `templates/search.json`
- Address: `/search/?q=<terms>`

| Variable | Type | Description |
| --- | --- | --- |
| `search` | hash | `terms`, `performed`, `resultsCount`, `productsCount`, `products`, `pages` and `articles` (pages and posts on the first page only). |
| `products` | list of [`product`](objects/product.md) | The matching offers of the current page. |
| `pagination` | hash | `page`, `pages`, `total` and `per_page`. |
| `sort` | string | The sort in use - `relevance` by default. |
| `sort_options` | list of string | `relevance` and the category sorts. |

## cart

- Template: `templates/cart.json`
- Address: `/cart/`

| Variable | Type | Description |
| --- | --- | --- |
| `cart` | [`cart`](objects/cart.md) | The visitor's cart. This page is never cached. |

## contact

- Template: `templates/contact.json`
- Address: `/contact/`

Only the global variables.

## 404

- Template: `templates/404.json`
- Address: `any unknown store address`

Only the global variables.

