Expand description
Builtin frontmatter field definitions.
This module is the single source of truth for all frontmatter fields
that moss recognizes. The schema returned by [schema::builtin_schema()]
is generated from the BUILTIN_FIELDS table, not from a hand-maintained
JSON file. This eliminates drift between the build pipeline’s FrontMatter
struct and the editor/validation schema.
§Adding a new field
- Add the field to
FrontMatterincrates/moss-core/src/frontmatter_typed.rs. - Add a corresponding entry to
BUILTIN_FIELDSin this file.
Both files live in the same crate — add new fields to both in the same commit. Co-location and PR review are the enforcement mechanism.
§skip_schema fields
Fields with skip_schema: true exist in the FrontMatter struct (the build
pipeline uses them) but are not exposed in the editor form or validation
schema. These are typically site-level config fields read only from the
homepage, auto-generated fields, or fields that will migrate to plugin-
contributed schemas.
§Scope groups (displayed order)
Fields are assigned to one of five scope groups, ordered broad to narrow:
- “This Page” — per-page content and display properties
- “Child Pages” — controls how children are listed
- “Child Styles” — visual/layout controls for child listings
- “Whole Site” — properties read from the homepage to affect the whole site
- “Other” — unknown user-authored fields (catch-all, TS side only)
§Scoring
Each field carries a score value that drives BOTH the chip-bar visible
order AND the add-property search-list order (lower score = first / more
prominent). Score is computed as:
score = 100 - (Frequency * 6 + Importance * 4)
where Frequency and Importance are each 0..=5 (higher = more common/important).
This means the maximum possible score is 100 (Frequency=0, Importance=0)
and the minimum is 100 - (56 + 54) = 0 (Frequency=5, Importance=5).
A lower score sorts earlier (more prominent position).
Structs§
- Builtin
Field - A builtin frontmatter field definition.
Constants§
- BUILTIN_
FIELDS - All builtin frontmatter fields recognized by moss.
Functions§
- asset_
field_ names - Frontmatter fields whose value is a path to a file in the project.