Theme Customization
This guide covers production-safe customization for Pagify frontend themes.
Before you start
Read the Theme Development Contract first.
A valid theme must include:
theme.jsonpages/home.json- static assets in
assets/js,assets/css,assets/img
Safe customization workflow
- Create a feature branch.
- Validate
theme.jsonstructure and slug. - Apply WSRE document updates in small commits.
- Verify fallback behavior with invalid/missing files.
- Run cache clear and re-test rendering.
Common customization tasks
1. Change homepage layout
Edit:
themes/main/{THEME_NAME}/pages/home.json
Optional shell control:
layout_htmlfield inside WSRE page document
2. Add new styles and scripts
Place files in:
themes/main/{THEME_NAME}/assets/cssthemes/main/{THEME_NAME}/assets/js
Use theme asset endpoint:
/theme-assets/{THEME_NAME}/css/app.css
/theme-assets/{THEME_NAME}/js/app.js
3. Add localized theme text
Add translation entries:
themes/main/{THEME_NAME}/lang/en/theme.phpthemes/main/{THEME_NAME}/lang/vi/theme.php
You can map localized values from backend/domain data into WSRE output when needed.
Validation checklist before merge
theme.jsonis valid JSON and slug matches directory- homepage renders with active theme
- fallback theme works when active theme is invalid
- no broken asset URLs
- cache cleared and re-verified
Troubleshooting
Theme not listed in manager:
- verify
theme.jsonexists and is valid - verify slug matches folder name
Theme selected but not rendered:
- verify
pages/home.jsonexists - verify fallback theme and default theme are valid
- clear cache:
php artisan optimize:clear
Operational recommendation
Treat theme updates like backend updates:
- small scoped changes
- explicit rollback path
- test in staging before production activation