JustFlows

Documentation is English-only for now. The rest of the site follows your language.

Templates

The WordPress-style template hierarchy: one JSON block document per slot, shared parts, and a visual editor for every template.

6 min read

Themes own page structure through a template hierarchy, the same idea WordPress uses. A theme ships one JSON block document per *slot* under templates/ and shared chrome under parts/. For each request the renderer builds an ordered list of candidate templates and renders the first one that exists, so a theme controls layout without touching the core views.

Template slots

A slot is a filename under the theme's templates/ folder. The renderer resolves from most specific to least specific and stops at the first match.

  • index — the universal fallback, always present.
  • front-page then home — the site home page.
  • single and single-<type> — one content item (single-post, single-product, …).
  • page and page-<slug> — a page, optionally by slug.
  • singular — any single item when there is no single* / page* match.
  • archive and 404 — list views and the not-found page.

Example: a blog post resolves single-postsinglesingularindex; the home page resolves front-pagehomeindex. The SDK export TEMPLATE_SLOTS is the full list.

Template parts

Shared chrome — headers, footers, sidebars — lives under parts/ and is pulled into a template with the core.template-part block. The header library and footer you edit in Theme builder are template parts, stored per site in the template_parts table.

Context blocks

A template is a layout with holes for the current request's content. Context blocks fill those holes with whatever page or post is being served: core.post-title, core.post-content, core.post-meta, core.post-excerpt, core.featured-image, and core.template-part.

Editing templates

Theme builder → Templates edits any template visually. Edits are saved per site in the theme_templates table (migration 0023_templates) with the same draft / publish / reset workflow as template parts and the footer. A site-level edit to a slug still yields to a more specific file that the theme ships.

CLI

bash
justflows theme templates          # list slots and where each request resolves
justflows theme scaffold <slug>    # write a starter template into the active theme

Tip

The bundled Default theme ships index, front-page, single, and page. demo/home.json, demo/blog.json, and demo/footer.json stay as back-compat fallbacks for the front-page / home / footer slots. SDK schemas: TemplateDocSchema, ThemeTemplatesManifestSchema.