Accent Template API

The asset

cms.asset — the asset this template renders, its shape, and the gates applied before a template sees it.


cms.asset is the asset this template is rendering. On a page render it is the page; inside a fragment view, a placed record or a section it is that mounted asset. The shape is the same everywhere, and a query row carries the same keys, so one partial can read x.title off cms.asset or off a listing row without caring which it was handed.

Shape

cms.asset
├─ id            stable uuid — the move-proof identity
├─ type          content type id
├─ title
├─ path          IA address ('' is the homepage); null for an unnamed record
├─ slug          the last segment of the path
├─ url           portable site: URI; rewritten to the live origin at output
├─ is_current    true on the asset being rendered
├─ published     publish state (public renders only ever see true)
├─ publishedAt · updatedAt
├─ content.*     authored field values — the type's content fields
├─ meta.*        metadata field values — head, sitemap, social
├─ options.*     render-config values — layouts and templates only, never the head
├─ data          the namespaced bag: { content, meta, options, taxonomy }
├─ taxonomy.*    reference lists, resolved to rows
├─ children[]    IA children as rows (pages under this address)
├─ outputs[]     the type's declared outputs as handles — see Outputs
└─ output(name)  one output as a handle — see Outputs

content, meta and options are the three field sets of the type, keyed by field key, decoded to runtime values. data is the same three under one namespaced address — cms.asset.data.content.tagline and cms.asset.content.tagline are one value — because storage and template addressing are deliberately the same shape. Media fields resolve to an object ({ src, alt, … }), references to rows of this same shape, dates to ISO strings; the Fields chapter documents each type's value.

There is no privileged body. A rich-text field named body is cms.asset.content.body and stringifies to HTML; the page's document is placed with content in a document template, not read off the asset.

Gates

Public renders are gated at the seam that builds these values: an unpublished asset never reaches cms.asset on the live site, children omits unpublished and hidden pages, and a page marked hidden-from-listings is absent from listings while still serving at its own address. Editor and preview renders see drafts. A template does not branch on any of this.

Reading it

<article class="<%= cms.asset.options.width === 'wide' ? 'mk-wide' : '' %>">
  <h1><%= cms.asset.title %></h1>
  <% if (cms.asset.meta.summary) { %><p class="lead"><%= cms.asset.meta.summary %></p><% } %>
  <% if (cms.asset.content.hero) { %>
    <img src="<%= cms.asset.content.hero.src %>" alt="<%= cms.asset.content.hero.alt %>">
  <% } %>
  <% cms.asset.children.forEach(function (child) { %>
    <a href="<%= child.url %>"><%= child.title %></a>
  <% }) %>
</article>

Deep records

  • The runtime API — cms.asset
  • Field sets — a third bucket: Options — why options can never leak into the head.
  • Content lanes — the decoders behind content, meta and options.