Files
CodePress/guide/en/theme-developer/theme-json.md
T
E.Noorlander 9a5ab351ba Update all guides (NL + EN) for CodePress 2.5.2 features
- Admin guide: RBAC roles, role-based dashboard, plugin types (content/system)
- CodePress developer guide: plugin types, admin plugin API, SCSS compilation, asset serving
- Theme developer guide: SCSS sole CSS source, css_compiled read-only, guide layout
- Content manager guide: layout selection from theme.json, plugin order in frontmatter
- Both NL and EN updated with identical structure
- 35 files updated
2026-08-12 12:05:53 +02:00

1.6 KiB

theme.json

{
    "title": "My Theme",
    "config": {
        "default_template": "full_content"
    },
    "template": {
        "full_content": "full_content.twig",
        "left_sidebar": "left_sidebar.twig",
        "right_sidebar": "right_sidebar.twig",
        "custom1": "custom1.twig",
        "guide": "guide.twig"
    }
}

Fields

  • title — Display name in admin
  • config.default_template — Default layout for pages without a layout: frontmatter (fallback for unknown layouts)
  • template — Mapping from layout name to .twig file

Template mapping

The template mapping defines which layouts are available. Each key is a layout name, each value is the .twig file:

Layout name Twig file Description
full_content full_content.twig Full width, no sidebar
left_sidebar left_sidebar.twig Sidebar on the left
right_sidebar right_sidebar.twig Sidebar on the right
custom1 custom1.twig Custom layout
guide guide.twig Guide with sidebar (Navigation plugin)

Layout selection

  • Layouts are chosen via the frontmatter layout: key in content files
  • Unknown layouts fall back to config.default_template
  • ThemeManager::getTemplates() returns the template mapping
  • ThemeManager::getConfig() returns the config section (including default_template)

Guide layout

The guide layout is special for guides. getGuidePage() in CodePressCMS.php automatically injects the Navigation plugin into the metadata for sidebar navigation.