Admin template context reference
Every admin page renders a typed Rust struct serialized to JSON, runs it through the optional before_render Lua hook, and hands it to Handlebars. This file lists every page, its page.type discriminant, the template it renders, and the fields the template can rely on.
Field types use Rust-style notation: string, integer, boolean, Vec<T>, Option<T>. Composite leaves like CrapMeta, NavData, FieldContext link into the shared definitions section at the bottom.
Login page
-
page.type:auth_login -
Template:
templates/auth/login.hbs -
crap(CrapMeta) -
_locale(string) -
available_locales(Vec<string>) -
title(string) -
page(PageMeta) -
error(Option<string>) (optional) — Error key (e.g.,"error_invalid_credentials") — present after a failed login post. -
email(Option<string>) (optional) — Pre-fills the email field after a failed login. -
collections(Vec<AuthCollection>) -
show_collection_picker(boolean) -
disable_local(boolean) -
show_forgot_password(boolean) -
success(Option<string>) (optional) — Whitelisted success-message key shown after redirect from logout / email verification / password reset. Always emitted (asnullwhen absent) to preserve the originalOption-as-null contract.
MFA challenge page
-
page.type:auth_mfa -
Template:
templates/auth/mfa.hbs -
crap(CrapMeta) -
_locale(string) -
available_locales(Vec<string>) -
title(string) -
page(PageMeta) -
error(Option<string>) (optional)
Forgot password page
-
page.type:auth_forgot -
Template:
templates/auth/forgot_password.hbs -
crap(CrapMeta) -
_locale(string) -
available_locales(Vec<string>) -
title(string) -
page(PageMeta) -
success(boolean) -
collections(Vec<AuthCollection>) -
show_collection_picker(boolean)
Reset password page
-
page.type:auth_reset -
Template:
templates/auth/reset_password.hbs -
crap(CrapMeta) -
_locale(string) -
available_locales(Vec<string>) -
title(string) -
page(PageMeta) -
token(Option<string>) (optional) — Token from the URL — present only when valid. Absent when the link is bad / expired (in which caseerroris set instead). -
error(Option<string>) (optional)
Error pages (403 / 404 / 500)
-
page.type:error_403 | error_404 | error_500 -
Template:
templates/errors/{403,404,500}.hbs -
crap(CrapMeta) -
nav(NavData) -
user(UserContext | null) (optional) -
_locale(string) — Active UI translation locale. -
available_locales(Vec<string>) — Available UI translation locales (for the locale picker). -
title(string) — Page title — duplicated at top level for backward compat with the base layout that reads{{title}}directly. Templates that have migrated read{{page.title}}instead. -
page(PageMeta) -
breadcrumbs(Vec<Breadcrumb>) — Top-level breadcrumb mirror ofpage.breadcrumbs. The breadcrumb partial preferspage.breadcrumbsand falls back to this. Kept for backward compat with overridden templates. -
has_editor_locales(Option<boolean>) (optional) -
editor_locale(Option<string>) (optional) -
editor_locales(Option<Vec<EditorLocaleOption>>) (optional) -
message(string) — User-facing error message body.
Dashboard
-
page.type:dashboard -
Template:
templates/dashboard/index.hbs -
crap(CrapMeta) -
nav(NavData) -
user(UserContext | null) (optional) -
_locale(string) — Active UI translation locale. -
available_locales(Vec<string>) — Available UI translation locales (for the locale picker). -
title(string) — Page title — duplicated at top level for backward compat with the base layout that reads{{title}}directly. Templates that have migrated read{{page.title}}instead. -
page(PageMeta) -
breadcrumbs(Vec<Breadcrumb>) — Top-level breadcrumb mirror ofpage.breadcrumbs. The breadcrumb partial preferspage.breadcrumbsand falls back to this. Kept for backward compat with overridden templates. -
has_editor_locales(Option<boolean>) (optional) -
editor_locale(Option<string>) (optional) -
editor_locales(Option<Vec<EditorLocaleOption>>) (optional) -
collection_cards(Vec<CollectionCard>) -
global_cards(Vec<GlobalCard>)
Collection list
-
page.type:collection_list -
Template:
templates/collections/list.hbs -
crap(CrapMeta) -
nav(NavData) -
user(UserContext | null) (optional) -
_locale(string) — Active UI translation locale. -
available_locales(Vec<string>) — Available UI translation locales (for the locale picker). -
title(string) — Page title — duplicated at top level for backward compat with the base layout that reads{{title}}directly. Templates that have migrated read{{page.title}}instead. -
page(PageMeta) -
breadcrumbs(Vec<Breadcrumb>) — Top-level breadcrumb mirror ofpage.breadcrumbs. The breadcrumb partial preferspage.breadcrumbsand falls back to this. Kept for backward compat with overridden templates. -
has_editor_locales(Option<boolean>) (optional) -
editor_locale(Option<string>) (optional) -
editor_locales(Option<Vec<EditorLocaleOption>>) (optional) -
collections(Vec<CollectionEntry>)
Collection items list
-
page.type:collection_items -
Template:
templates/collections/items.hbs -
crap(CrapMeta) -
nav(NavData) -
user(UserContext | null) (optional) -
_locale(string) — Active UI translation locale. -
available_locales(Vec<string>) — Available UI translation locales (for the locale picker). -
title(string) — Page title — duplicated at top level for backward compat with the base layout that reads{{title}}directly. Templates that have migrated read{{page.title}}instead. -
page(PageMeta) -
breadcrumbs(Vec<Breadcrumb>) — Top-level breadcrumb mirror ofpage.breadcrumbs. The breadcrumb partial preferspage.breadcrumbsand falls back to this. Kept for backward compat with overridden templates. -
has_editor_locales(Option<boolean>) (optional) -
editor_locale(Option<string>) (optional) -
editor_locales(Option<Vec<EditorLocaleOption>>) (optional) -
collection(CollectionContext) -
perms(CollectionPermissions) -
docs(Vec<any>) -
pagination(PaginationContext) -
has_drafts(boolean) -
has_soft_delete(boolean) -
is_trash(boolean) -
search(Option<string>) (optional) -
sort(Option<string>) (optional) -
table_columns(Vec<any>) -
column_options(Vec<any>) -
filter_fields(Vec<any>) -
active_filters(Vec<any>) -
active_filter_count(integer) -
title_sort_url(Option<string>) (optional) -
title_sorted_asc(boolean) -
title_sorted_desc(boolean)
Collection edit form
-
page.type:collection_edit -
Template:
templates/collections/edit.hbs -
crap(CrapMeta) -
nav(NavData) -
user(UserContext | null) (optional) -
_locale(string) — Active UI translation locale. -
available_locales(Vec<string>) — Available UI translation locales (for the locale picker). -
title(string) — Page title — duplicated at top level for backward compat with the base layout that reads{{title}}directly. Templates that have migrated read{{page.title}}instead. -
page(PageMeta) -
breadcrumbs(Vec<Breadcrumb>) — Top-level breadcrumb mirror ofpage.breadcrumbs. The breadcrumb partial preferspage.breadcrumbsand falls back to this. Kept for backward compat with overridden templates. -
has_editor_locales(Option<boolean>) (optional) -
editor_locale(Option<string>) (optional) -
editor_locales(Option<Vec<EditorLocaleOption>>) (optional) -
collection(CollectionContext) -
perms(CollectionPermissions) -
document(DocumentRef) -
fields(Vec<FieldContext>) -
sidebar_fields(Vec<FieldContext>) -
editing(boolean) -
has_drafts(boolean) -
has_versions(boolean) -
versions(Vec<any>) -
has_more_versions(boolean) -
restore_url_prefix(string) -
versions_url(string) -
document_title(string) -
ref_count(integer) -
has_locales(boolean) (optional) -
current_locale(string) (optional) -
locales(Vec<LocaleTemplateOption>) (optional) -
upload(UploadFormContext | null) (optional) — Upload preview block — present only on upload collections.
Collection create form
-
page.type:collection_create -
Template:
templates/collections/edit.hbs -
crap(CrapMeta) -
nav(NavData) -
user(UserContext | null) (optional) -
_locale(string) — Active UI translation locale. -
available_locales(Vec<string>) — Available UI translation locales (for the locale picker). -
title(string) — Page title — duplicated at top level for backward compat with the base layout that reads{{title}}directly. Templates that have migrated read{{page.title}}instead. -
page(PageMeta) -
breadcrumbs(Vec<Breadcrumb>) — Top-level breadcrumb mirror ofpage.breadcrumbs. The breadcrumb partial preferspage.breadcrumbsand falls back to this. Kept for backward compat with overridden templates. -
has_editor_locales(Option<boolean>) (optional) -
editor_locale(Option<string>) (optional) -
editor_locales(Option<Vec<EditorLocaleOption>>) (optional) -
collection(CollectionContext) -
perms(CollectionPermissions) -
fields(Vec<FieldContext>) -
sidebar_fields(Vec<FieldContext>) -
editing(boolean) -
has_drafts(boolean) -
has_locales(boolean) (optional) -
current_locale(string) (optional) -
locales(Vec<LocaleTemplateOption>) (optional) -
upload(UploadFormContext | null) (optional)
Collection form-error re-render
-
page.type:collection_edit | collection_create -
Template:
templates/collections/edit.hbs -
crap(CrapMeta) -
nav(NavData) -
user(UserContext | null) (optional) -
_locale(string) — Active UI translation locale. -
available_locales(Vec<string>) — Available UI translation locales (for the locale picker). -
title(string) — Page title — duplicated at top level for backward compat with the base layout that reads{{title}}directly. Templates that have migrated read{{page.title}}instead. -
page(PageMeta) -
breadcrumbs(Vec<Breadcrumb>) — Top-level breadcrumb mirror ofpage.breadcrumbs. The breadcrumb partial preferspage.breadcrumbsand falls back to this. Kept for backward compat with overridden templates. -
has_editor_locales(Option<boolean>) (optional) -
editor_locale(Option<string>) (optional) -
editor_locales(Option<Vec<EditorLocaleOption>>) (optional) -
collection(CollectionContext) -
perms(CollectionPermissions) -
document(DocumentRef | null) (optional) — Document stub (withidonly) on edit error; absent on create error. -
fields(Vec<FieldContext>) -
sidebar_fields(Vec<FieldContext>) -
editing(boolean) -
has_drafts(boolean) -
upload_hidden_fields(Option<Vec<any>>) (optional) — Hidden upload fields preserved from the submitted form (edit-mode upload errors only, so the user keeps their pending file metadata).
Collection delete confirmation
-
page.type:collection_delete -
Template:
templates/collections/delete.hbs -
crap(CrapMeta) -
nav(NavData) -
user(UserContext | null) (optional) -
_locale(string) — Active UI translation locale. -
available_locales(Vec<string>) — Available UI translation locales (for the locale picker). -
title(string) — Page title — duplicated at top level for backward compat with the base layout that reads{{title}}directly. Templates that have migrated read{{page.title}}instead. -
page(PageMeta) -
breadcrumbs(Vec<Breadcrumb>) — Top-level breadcrumb mirror ofpage.breadcrumbs. The breadcrumb partial preferspage.breadcrumbsand falls back to this. Kept for backward compat with overridden templates. -
has_editor_locales(Option<boolean>) (optional) -
editor_locale(Option<string>) (optional) -
editor_locales(Option<Vec<EditorLocaleOption>>) (optional) -
collection(CollectionContext) -
document_id(string) -
title_value(Option<string>) (optional) — Document title for display.None(serialized asnull) when the collection has no title field or the read fell through. -
ref_count(integer)
Collection versions list
-
page.type:collection_versions -
Template:
templates/collections/versions.hbs -
crap(CrapMeta) -
nav(NavData) -
user(UserContext | null) (optional) -
_locale(string) — Active UI translation locale. -
available_locales(Vec<string>) — Available UI translation locales (for the locale picker). -
title(string) — Page title — duplicated at top level for backward compat with the base layout that reads{{title}}directly. Templates that have migrated read{{page.title}}instead. -
page(PageMeta) -
breadcrumbs(Vec<Breadcrumb>) — Top-level breadcrumb mirror ofpage.breadcrumbs. The breadcrumb partial preferspage.breadcrumbsand falls back to this. Kept for backward compat with overridden templates. -
has_editor_locales(Option<boolean>) (optional) -
editor_locale(Option<string>) (optional) -
editor_locales(Option<Vec<EditorLocaleOption>>) (optional) -
collection(CollectionContext) -
document(DocumentRef) -
pagination(PaginationContext) -
doc_title(string) -
versions(Vec<any>) -
restore_url_prefix(string)
Collection restore confirmation
-
page.type:collection_versions -
Template:
templates/collections/restore.hbs -
crap(CrapMeta) -
nav(NavData) -
user(UserContext | null) (optional) -
_locale(string) — Active UI translation locale. -
available_locales(Vec<string>) — Available UI translation locales (for the locale picker). -
title(string) — Page title — duplicated at top level for backward compat with the base layout that reads{{title}}directly. Templates that have migrated read{{page.title}}instead. -
page(PageMeta) -
breadcrumbs(Vec<Breadcrumb>) — Top-level breadcrumb mirror ofpage.breadcrumbs. The breadcrumb partial preferspage.breadcrumbsand falls back to this. Kept for backward compat with overridden templates. -
has_editor_locales(Option<boolean>) (optional) -
editor_locale(Option<string>) (optional) -
editor_locales(Option<Vec<EditorLocaleOption>>) (optional) -
collection(CollectionContext) -
document(DocumentRef) -
version_number(any) — Version number being restored (from the version row’sversioncolumn). -
missing_relations(Vec<any>) — IDs of relationship references whose targets no longer exist. -
restore_url(string) -
back_url(string)
Global edit form
-
page.type:global_edit -
Template:
templates/globals/edit.hbs -
crap(CrapMeta) -
nav(NavData) -
user(UserContext | null) (optional) -
_locale(string) — Active UI translation locale. -
available_locales(Vec<string>) — Available UI translation locales (for the locale picker). -
title(string) — Page title — duplicated at top level for backward compat with the base layout that reads{{title}}directly. Templates that have migrated read{{page.title}}instead. -
page(PageMeta) -
breadcrumbs(Vec<Breadcrumb>) — Top-level breadcrumb mirror ofpage.breadcrumbs. The breadcrumb partial preferspage.breadcrumbsand falls back to this. Kept for backward compat with overridden templates. -
has_editor_locales(Option<boolean>) (optional) -
editor_locale(Option<string>) (optional) -
editor_locales(Option<Vec<EditorLocaleOption>>) (optional) -
global(GlobalContext) -
perms(GlobalPermissions) -
fields(Vec<FieldContext>) -
sidebar_fields(Vec<FieldContext>) -
has_drafts(boolean) -
has_versions(boolean) -
versions(Vec<any>) -
has_more_versions(boolean) -
restore_url_prefix(string) -
versions_url(string) -
doc_status(string) -
has_locales(boolean) (optional) -
current_locale(string) (optional) -
locales(Vec<LocaleTemplateOption>) (optional)
Global form-error re-render
-
page.type:global_edit -
Template:
templates/globals/edit.hbs -
crap(CrapMeta) -
nav(NavData) -
user(UserContext | null) (optional) -
_locale(string) — Active UI translation locale. -
available_locales(Vec<string>) — Available UI translation locales (for the locale picker). -
title(string) — Page title — duplicated at top level for backward compat with the base layout that reads{{title}}directly. Templates that have migrated read{{page.title}}instead. -
page(PageMeta) -
breadcrumbs(Vec<Breadcrumb>) — Top-level breadcrumb mirror ofpage.breadcrumbs. The breadcrumb partial preferspage.breadcrumbsand falls back to this. Kept for backward compat with overridden templates. -
has_editor_locales(Option<boolean>) (optional) -
editor_locale(Option<string>) (optional) -
editor_locales(Option<Vec<EditorLocaleOption>>) (optional) -
global(GlobalContext) -
perms(GlobalPermissions) -
fields(Vec<FieldContext>) -
sidebar_fields(Vec<FieldContext>)
Global versions list
-
page.type:global_versions -
Template:
templates/globals/versions.hbs -
crap(CrapMeta) -
nav(NavData) -
user(UserContext | null) (optional) -
_locale(string) — Active UI translation locale. -
available_locales(Vec<string>) — Available UI translation locales (for the locale picker). -
title(string) — Page title — duplicated at top level for backward compat with the base layout that reads{{title}}directly. Templates that have migrated read{{page.title}}instead. -
page(PageMeta) -
breadcrumbs(Vec<Breadcrumb>) — Top-level breadcrumb mirror ofpage.breadcrumbs. The breadcrumb partial preferspage.breadcrumbsand falls back to this. Kept for backward compat with overridden templates. -
has_editor_locales(Option<boolean>) (optional) -
editor_locale(Option<string>) (optional) -
editor_locales(Option<Vec<EditorLocaleOption>>) (optional) -
global(GlobalContext) -
pagination(PaginationContext) -
versions(Vec<any>) -
restore_url_prefix(string)
Global restore confirmation
-
page.type:global_versions -
Template:
templates/globals/restore.hbs -
crap(CrapMeta) -
nav(NavData) -
user(UserContext | null) (optional) -
_locale(string) — Active UI translation locale. -
available_locales(Vec<string>) — Available UI translation locales (for the locale picker). -
title(string) — Page title — duplicated at top level for backward compat with the base layout that reads{{title}}directly. Templates that have migrated read{{page.title}}instead. -
page(PageMeta) -
breadcrumbs(Vec<Breadcrumb>) — Top-level breadcrumb mirror ofpage.breadcrumbs. The breadcrumb partial preferspage.breadcrumbsand falls back to this. Kept for backward compat with overridden templates. -
has_editor_locales(Option<boolean>) (optional) -
editor_locale(Option<string>) (optional) -
editor_locales(Option<Vec<EditorLocaleOption>>) (optional) -
global(GlobalContext) -
version_number(any) -
missing_relations(Vec<any>) -
restore_url(string) -
back_url(string)
Shared definitions
Every page above flattens BasePageContext (or AuthBasePageContext for auth-flow pages) into its top-level fields. The base structs and their leaves are defined here once.
BasePageContext
crap(CrapMeta)nav(NavData)user(UserContext | null) (optional)_locale(string) — Active UI translation locale.available_locales(Vec<string>) — Available UI translation locales (for the locale picker).title(string) — Page title — duplicated at top level for backward compat with the base layout that reads{{title}}directly. Templates that have migrated read{{page.title}}instead.page(PageMeta)breadcrumbs(Vec<Breadcrumb>) — Top-level breadcrumb mirror ofpage.breadcrumbs. The breadcrumb partial preferspage.breadcrumbsand falls back to this. Kept for backward compat with overridden templates.has_editor_locales(Option<boolean>) (optional)editor_locale(Option<string>) (optional)editor_locales(Option<Vec<EditorLocaleOption>>) (optional)
AuthBasePageContext
PageMeta
type(string) — Page-type discriminant. Serialized as asnake_casestring literal so templates can branch with{{#if (eq page.type "collection_edit")}}.title(string) — Page title or translation key.title_name(Option<string>) (optional) — Optional interpolation param for{{t page.title name=page.title_name}}.breadcrumbs(Vec<Breadcrumb>) — Breadcrumb trail rendered bypartials/breadcrumb.hbs.
CrapMeta
version(string) — Crate version (Cargo.tomlversion).build_hash(string) — Build hash (set by build script from git).dev_mode(boolean) — Whether admin dev-mode is enabled (per-request template reload, etc.).auth_enabled(boolean) — Whether the system has any auth-enabled collections.csp_nonce(string) — Per-request CSP nonce (empty string outside request scope).site_name(string) — Branding string shown in the admin header wordmark and<title>tags. Defaults to"Crap CMS"; configurable via[admin] site_name = "..."incrap.toml.
NavData
collections(Vec<NavCollection>)globals(Vec<NavGlobal>)custom_pages(Vec<CustomPage>) — Filesystem-routed custom admin pages registered viacrap.pages.register. Only entries with alabelset appear here.
NavCollection
slug(string)display_name(string)is_auth(boolean)is_upload(boolean)
NavGlobal
slug(string)display_name(string)
UserContext
email(string)id(string)collection(string)
EditorLocaleOption
value(string)label(string)selected(boolean)
LocaleTemplateOption
value(string)label(string)selected(boolean)
Breadcrumb
label(string) — The text label to display for the breadcrumb.url(Option<string>) (optional) — The optional URL to link to. If None, the breadcrumb is the current page.label_name(Option<string>) (optional) — Optional interpolation param for{{t label name=label_name}}.
CollectionContext
slug(string)display_name(string)singular_name(string)title_field(Option<string>) (optional)timestamps(boolean)soft_delete(boolean)admin(AdminMeta)upload(UploadMeta | null) (optional)versions(VersionsMeta | null) (optional)auth(AuthMeta | null) (optional)fields_meta(Vec<FieldMeta>)
GlobalContext
slug(string)display_name(string)has_drafts(boolean)has_versions(boolean)versions(VersionsMeta | null) (optional)fields_meta(Vec<FieldMeta>)
DocumentRef
id(string)created_at(Option<string>) (optional)updated_at(Option<string>) (optional)status(Option<string>) (optional)data(DocumentFields | null) (optional)
PaginationContext
per_page(integer)total(integer)has_prev(boolean)has_next(boolean)prev_url(string)next_url(string)page(Option<integer>) (optional) — Page-mode only — current page number (1-indexed).total_pages(Option<integer>) (optional) — Page-mode only — total page count.
FieldContext
(No fields.)
AuthCollection
slug(string)display_name(string)
CollectionEntry
slug(string)display_name(string)field_count(integer)
CollectionCard
slug(string)display_name(string)singular_name(string)count(integer)last_updated(Option<string>) (optional)is_auth(boolean)is_upload(boolean)has_versions(boolean)
GlobalCard
slug(string)display_name(string)last_updated(Option<string>) (optional)has_versions(boolean)
UploadFormContext
accept(Option<string>) (optional) — Comma-joined accept list for the file input — emitted only when the collection declares allowed mime types.focal_x(Option<number>) (optional)focal_y(Option<number>) (optional)preview(Option<string>) (optional) — Image preview URL when the file is an image.info(UploadInfo | null) (optional) — Filename + dimensions/filesize info pill.
UploadInfo
filename(string)filesize_display(Option<string>) (optional)dimensions(Option<string>) (optional)