Skip to content

CMS Overview ​

The Cms module turns Modularous into a multi-locale public site: content models get URL prefixes, published paths live in a registry, and presentation is composed from stylesheets → layout shells → per-model page layouts.

Enable the stack with modularous.cms_features.enabled (and related toggles under Configuration).

Building blocks ​

PieceRole
ParentSegmentPer model class + locale: shared public URL prefix
UrlRouteFlat registry of published paths (page_public, redirect_source)
StyleSheetCompiled CSS (+ framework links)
LayoutBuilderReusable HTML document shell; attaches StyleSheet(s)
PageLayoutLocale-agnostic presentation binding per model class; points at a LayoutBuilder
Page / CMR modelsContent (IsCmr = parent segment + page layout)
RedirectFrom/to path rules; synced into UrlRoute
SitemapBuilt from page_public UrlRoute rows; served at /sitemap.xml

How a public page request flows ​

mermaid
flowchart LR
  Req["GET path"] --> Sys["System routes\nrobots sitemap preview css"]
  Req --> Host["Host routes/web.php"]
  Req --> Catch["CMS catch-all\nCmsPublicFrontController"]
  Catch --> Redir["VisitorRedirectMiddleware"]
  Redir --> Resolve["CmsPublicModelResolver\nvia UrlRoute"]
  Resolve --> Render["CmsController presentation\nStyleSheet + LayoutBuilder + PageLayout"]
  1. Built-in system routes and host routes/web.php run before the catch-all — see Public routing.
  2. Remaining paths hit the CMS catch-all; redirects may fire before page resolve — Redirects.
  3. UrlRoute + ParentSegment gate resolve the model — Parent segments & URL routes.
  4. Presentation layers (bottom → top): Stylesheets → Layout builders → Page layouts.
    • Themes: cms.layout_builder.{slug}.* under resources/views/cms/layout_builder/{slug}/ (blade_view_name often NULL).
    • Per-route bodies: {module}::{route}.page_layout.* under modules/{Module}/Resources/views/{route}/page_layout/ (blade_view_name often NULL).

Relationship map ​

mermaid
flowchart TB
  SS["StyleSheet\nCSS bundles"] --> LB["LayoutBuilder\nshell"]
  LB --> PL["PageLayout\nper model class"]
  Model["Page / CMR model"] --> PL
  Model --> UR["UrlRoute\nnormalized_path"]
  PS["ParentSegment\nprefix per locale"] --> UR
  Redir["Redirect"] --> UR
  UR --> Sitemap["Sitemap XML"]
  • Presentation stack: StyleSheet → LayoutBuilder → PageLayout (read the guides in that order).
  • URLs live on ParentSegment + UrlRoute (and Redirect) — separate from Blade shells.
  • Do not put Blade shells on ParentSegment — that split is intentional.

Guide index ​

TopicPage
Catch-all, host web.php, excludesPublic routing
Prefixes + UrlRoute registryParent segments & URL routes
CSS compile + public .css routeStylesheets
Document shell + Blade sourcesLayout builders
Per-model presentation bindingPage layouts
Visitor redirectsRedirects
/sitemap.xml + robotsSitemap & SEO
modularous.cms_* keysConfiguration