Come build with us.
Stacks API v13 for Stacks 5.0
Theme API
Theme properties are supplied at render time. The bundled schema says the Theme API version is injected by the runtime rather than read from Info.plist.
The following values are demonstrated by bundled themes. This is not yet a complete object reference.
These values insert content generated by Stacks and other page components:
content.prefix — content before the doctype.content.headAbove — content near the beginning of <head>.content.headBelow — content near the end of <head>.content.bodyAbove — content before normal page stacks.content.body — the page’s primary Stacks content.content.bodyBelow — content after normal page stacks.content.suffix — content after the closing document markup.Do not omit these casually. Other stacks can publish page-scoped templates into the above/below insertion points.
The Sample theme demonstrates:
page.titlepage.uidpage.fileNamepage.linkAdditional page properties may be present. Rendering :(page): during development can help inspect the current runtime object, but debug output should not be shipped in a production theme.
The Sample theme demonstrates:
site.baseURLsite.domainsite.titlesite.urlStringsite.copyrightsite.pages.childrensite.theme.parent.titlesite.theme.parent.uidItems from site.pages.children demonstrate:
hreftitlenavTitlechildrenNested navigation can be built by iterating over children or by passing the page item to an included partial.
The Sample theme iterates over breadcrumbs. Each demonstrated breadcrumb has:
currenttitlehrefBase contains debug examples for:
theme.titletheme.uidsite.theme.parent.titlesite.theme.parent.uidThe complete relationship between the top-level theme object and site.theme is not yet specified.
Blank demonstrates:
siteCssPathlayoutCssPathpageCssPathpageJsPathBase also refers to assetPath in its comments. Themes with static assets should prefer runtime-generated paths over hard-coded page-relative URLs.
Sample suggests temporarily outputting an object during development:
<pre>:(site):</pre>
Use this only in a local test theme. Runtime objects may contain verbose implementation details and their unescaped representation may not be appropriate for public output.