Git-First Templates Since 3.5.0
By default, Site Builder templates live in tcms-data/builder/ and you edit them in the dashboard. That’s perfect for content-led sites, but developers usually want their templates in git — edited in an IDE, reviewed in pull requests, and deployed like any other code.
Total CMS supports this with zero configuration. If a builder/ folder exists at your project root, templates are git-managed; if it doesn’t, nothing changes. This mirrors how Total CMS already detects tcms-data — by directory presence, not a setting.
Turning it on
Section titled “Turning it on”Move your builder templates to the project root (alongside public/ and config/):
mv tcms-data/builder ./builderThat’s the entire switch. The folder’s presence is what activates git-managed mode. (A fresh project can instead run tcms builder:init <starter>, which scaffolds straight into ./builder when it exists, or your composer create-project setup can create it for you.)
Now commit ./builder — there’s nothing special to ignore. tcms-data/ stays gitignored as always (your content and media are not in git), and edit-history snapshots live under tcms-data/, never in ./builder — so the whole ./builder folder is clean to commit.
What changes when templates are git-managed
Section titled “What changes when templates are git-managed”| Admin-first (default) | Git-managed (./builder exists) | |
|---|---|---|
| Templates live in | tcms-data/builder/ | ./builder/ (committed) |
| Editing | In the dashboard | In your IDE → commit → deploy |
| Dashboard editor | Editable | Read-only (“Editing Disabled”), except when env is dev |
| Template sync | Via the Sync Manager | Disabled — templates travel by git |
Read hierarchy
Section titled “Read hierarchy”Templates resolve in this order (first match wins):
./builder/— your committed templatestcms-data/builder/— anything edited in the dashboard (legacy / leftover)- Total CMS’s built-in defaults (e.g.
layouts/default.twig) — the floor, so a bare builder still renders
So your committed templates always win, and you can extend the shipped layouts/default.twig without copying it.
The dashboard goes read-only
Section titled “The dashboard goes read-only”Once ./builder exists, the template and builder editors show an “Editing Disabled” notice and hide Save/Delete. This keeps a server’s files clean, so a deploy’s git pull can’t conflict with an edit made on the server.
Editing in the dashboard during development
Section titled “Editing in the dashboard during development”When env is dev ($settings['env'] = 'dev';), the dashboard editor stays editable. A save writes to ./builder, the same file your code editor would change, so it appears in git status as an uncommitted change. Commit it to deploy it.
Only dev unlocks the editor. Production, staging and any site that hasn’t set env stay read-only, so make sure env isn’t dev on a server you deploy to. Sync and the Template Designer still skip git-managed templates in dev.
The lock also covers other template writes. In dev, a JumpStart import and tcms builder:history restores write to ./builder too. Check git status after running them.
Deploying
Section titled “Deploying”Because templates are committed and the dashboard can’t write them on a server, your production working tree stays clean — a deploy webhook’s git pull never hits an uncommitted-changes conflict:
cd /var/www/your-sitegit pull # brings in template changes# clear caches as usual — see the Deployment guideSee the Deployment guide for webhook and cache-clearing details.
Pages and content still use Sync
Section titled “Pages and content still use Sync”Git-first templates cover templates only. Your pages (the builder-pages records: routes, template bindings, nav, content) and other collection data are not git-controlled — they’re promoted local → production with the Sync Manager, exactly as before. Each artifact has one delivery channel:
- Templates → git
- Pages & content → Sync
So a fresh git clone brings up your templates; running a sync brings the pages and content over.
Going back
Section titled “Going back”Delete (or move back) the ./builder folder and the site returns to admin-first: templates live in tcms-data/builder/ and are editable in the dashboard again. There’s no setting to flip.