Custom layouts are Handlebars templates. This page is the reference: the Handlebars you'll actually use, every token the renderer hands you, and which page surfaces each token resolves on.
New to custom layouts? Start with the overview first; this page assumes you know what a layout and a surface are.
Handlebars in 30 seconds
{{token}}— insert a value, HTML-escaped. Safe for text.{{{token}}}— insert a value raw, no escaping. Use this only for values that are already HTML:{{{article.body}}},{{{theme.cssBlock}}},{{{assets.head}}},{{{assets.bodyEnd}}},{{{community.content}}}and{{{community.styles}}}.{{#if token}} … {{/if}}— render the block only when the value is present/true. The way to make one template handle multiple surfaces.{{#each list}} … {{/each}}— loop. Inside the block, the item's own fields are in scope directly ({{title}}, not{{articles.title}}).{{> partialId}}— include a partial.{{! a comment }}— not rendered.
{{article.title}} on the channel home (where there's no single article) just produces nothing — it doesn't break the page. That's why one layout can safely cover several surfaces if you wrap the surface-specific parts in {{#if article}} / {{#if articles}} / {{#if asset}} / {{#if community}}.
Where tokens resolve
A layout can be used on any surface. These groups are always available:
- channel, theme, site, assets — resolve on every surface.
These depend on the surface the layout is rendering:
- article — article & page detail pages only.
- articles, topArticle — the channel home only.
- asset — asset pages only.
- community — community pages only (board, post, post form, join, member profile, own profile).
channel — everywhere
| Token | Value |
|---|---|
{{channel.name}} | Channel title |
{{channel.slug}} | URL permalink |
{{channel.tagline}} | Tagline from the theme header |
{{channel.logo}} | Logo URL from the theme header |
{{channel.description}} | Channel description |
theme — everywhere
| Token | Value |
|---|---|
{{{theme.cssBlock}}} | Pre-built <style> + Google Fonts <link> exposing the palette as --brand-* variables. Triple-stash, put it in <head>. |
{{theme.colors.primary}} | Primary hex (also accent, surface, text, muted) |
{{theme.fonts.heading}} | Heading font family (also body) |
{{theme.footer.copyright}} | Footer copyright line (also text) |
{{#each theme.social}} | Social links; each item has icon, url, label |
Prefer the CSS variables from {{{theme.cssBlock}}} over the raw hex tokens: write color: var(--brand-primary) in your styles, not color: {{theme.colors.primary}}. The variables update automatically when the palette changes; interpolated hex is frozen at render time. The variables are --brand-primary, --brand-accent, --brand-surface, --brand-text, --brand-muted, --brand-font-heading, --brand-font-body.
site — everywhere
| Token | Value |
|---|---|
{{site.url}} | Site base URL |
{{site.currentYear}} | Current year (handy for a footer) |
{{site.cultureCode}} | Culture, e.g. en — use in <html lang> |
assets — everywhere
The CSS and JavaScript files registered as the channel's assets (channel settings → Manage channel assets, or create_channel_asset over MCP) are not added to a custom layout for you. A layout loads them with these two tokens; without them, none of the channel's registered CSS or JavaScript reaches the page.
| Token | Value |
|---|---|
{{{assets.head}}} | The <link> and <script> tags for the assets that apply to this page. Triple-stash, put it in <head>. Empty when none apply, so it is always safe to include. |
{{{assets.bodyEnd}}} | The JavaScript assets set to load at the end of the body. Triple-stash, put it right before </body>. |
Which assets apply depends on each asset's scope:
- All pages — loaded on every surface, community pages included.
- A folder or a tag — loaded only on article and page detail pages in that folder or with that tag. Not on the channel home, asset pages or community pages.
Put each token in a page once: every copy writes the tags again, so a layout and a partial that both include {{{assets.head}}} load each file twice. Keeping both tokens in one shared head and footer partial is the simplest way to be sure. Both are empty on the 404 page and in the Theme editor's preview, which uses sample data, so check assets on the real page.
article — article & page detail
| Token | Value |
|---|---|
{{article.title}} | Title |
{{{article.body}}} | Rendered article HTML. Triple-stash. |
{{article.excerpt}} | Short description / SEO summary |
{{article.publishedAt}} | Publish timestamp |
{{article.coverImage}} | Main image URL |
{{article.url}} | Canonical path to this article |
{{article.author.name}} | Byline name (also author.avatar, author.slug) |
{{#each article.tags}} | Tags; each item is the tag string ({{this}}) |
articles & topArticle — channel home
{{#each articles}} iterates the home list. Inside the loop each item exposes title, excerpt, publishedAt, coverImage, url, and author.name. {{topArticle.title}} (and the same fields) is the single most prominent article, for a hero slot.
{{#each articles}}
<article>
<a href="{{url}}"><h2>{{title}}</h2></a>
{{#if excerpt}}<p>{{excerpt}}</p>{{/if}}
</article>
{{/each}}
asset — asset pages
| Token | Value |
|---|---|
{{asset.title}} | Asset title |
{{asset.description}} | Description |
{{asset.url}} | The file URL |
{{#if asset.isImage}} | True for images — render an <img> |
{{#if asset.isVideo}} | True for video — render a <video> |
community — community pages
One layout wraps every community page; bind it under Theme → Community pages. OmniCon renders the page itself (the board, a post, the post form, join, or a profile) and hands it to the layout ready-made, with its forms and their security tokens intact. Posting, joining, replying, liking and moderation keep working without anything in the layout.
| Token | Value |
|---|---|
{{{community.content}}} | The community page. Triple-stash, exactly once, where the page should go. Required: without it the layout shows no community at all. |
{{{community.styles}}} | Optional, in <head>. The stylesheet the built-in community markup is written for. Leave it out to style that markup with your own CSS; it sits inside <div class="omni-community omni-community--{page}">. |
{{community.name}} | The community's display name |
{{community.tagline}} | The community's tagline |
{{community.url}} | Address of the board |
{{community.title}} | This page's title, for <title> |
{{community.page}} | board, post, post-form, join, member or profile |
article, articles and asset are empty on community pages. To serve articles and the community from one layout, wrap the community part in {{#if community}} … {{/if}}. If the layout fails to render, visitors get the built-in community page and the error is shown on the Theme page. A complete example is in Enabling a community on your channel.
Partials
Include a partial with {{> partialId}}, where partialId is the Id shown in the Partials table on the Theme page. A partial sees the same data context as the layout that calls it — all the tokens above work inside a partial too — and a partial may include other partials. Use them for shared chrome: header, footer, a left menu, a reusable card. The same partials work in a community layout, so a shared header edited once changes on articles and community pages alike.
- On the Theme page (Custom layouts mode), create a partial called Site footer with body
<footer>© {{site.currentYear}} {{channel.name}}</footer>. Its reference shows as{{> site-footer}}. - In a layout, add
{{> site-footer}}just before</body>. Preview — the footer renders with the channel name and year filled in. - Edit the partial (change the text), save, re-preview the layout — the change shows without touching the layout.
See also
- Custom layouts — the overview and the mode switch.
- Layout recipes — complete copy-paste templates that use these tokens.
- Enabling a community on your channel — putting the community inside your own layout.