Joomla Template Overrides: Change Output Without Core Hacks
Sooner or later every Joomla site owner wants to change how something looks: the author line under an article, the markup of a menu, the layout of a blog page. The wrong way is to edit Joomla's core files - the next update erases your work. The right way is one of Joomla's best ideas: template overrides, your own copy of any output file, safely stored in your template, automatically preferred over the original.
This article is a deep dive into Joomla's override system. It covers the basics for owners and editors, practical override work for site builders, and the technical details for developers. It builds on the Focus On article about Joomla templates, which introduces templates as a whole; here we focus entirely on overrides: component and module overrides, chrome, layout overrides, alternative layouts, child templates, and - the part almost everyone skips - how to keep overrides healthy across Joomla updates.
An override is a polite disagreement with Joomla: you change the output, and the core stays untouched.
The goal is simple: help you customise any Joomla output without ever touching a core file.
1. The Basics
1.1 What is a Template Override?
When Joomla renders a page, every piece of output comes from a small PHP file: an article from the com_content article layout, a menu from the mod_menu layout, a pagination bar from a shared layout file. A template override is a copy of such a file placed inside your template's html/ folder. If the copy exists, Joomla uses it and ignores the original. If not, the original runs.
components/com_content/tmpl/article/default.php the original (core)
templates/cassiopeia/html/com_content/article/default.php your override
That is the entire mechanism. No configuration, no registration, no database entry - the file's existence is the override.
1.2 Why Overrides Exist
- Updates stay safe: core files are replaced on every Joomla update; your
html/folder is not touched. - Any markup becomes yours: you control every class, tag, and attribute without hacking anything.
- They are honest: anyone auditing the site finds all customisations in one predictable place.
1.3 What Can Be Overridden
| Output | Override lives in |
|---|---|
| Component views (article, category list, contact, ...) | html/com_content/article/, html/com_contact/contact/, ... |
| Modules (menu, login, articles, ...) | html/mod_menu/, html/mod_login/, ... |
| Shared layouts (JLayout: pagination, fields, buttons, ...) | html/layouts/joomla/... |
| Module chrome (the box around a module) | html/layouts/chromes/ |
Cassiopeia itself ships with overrides - look inside templates/cassiopeia/html/ and you find mod_menu layouts (the metismenu dropdowns), a mod_custom banner layout, and two chromes (card.php, noCard.php). The core template uses the same mechanism you will use.
The mechanism also covers third-party extensions: a well-built shop, blog, or events component is overridden as html/com_theircomponent/... and its modules as html/mod_theirmodule/, exactly like core. Whether an extension is cleanly overridable is a useful quality test before you adopt it.
One thing that looks like an override subject but is not: system emails. Registration mails, password resets, and other notifications are customised through the Mail Templates component in the backend - see the Focus On article about mail templates - not through files in html/.
2. Your First Override
2.1 The Backend Way (Recommended)
Joomla creates overrides for you, with the correct paths, in the template manager:
- Go to System → Site Templates and open your template (not the style - the template).
- Open the Create Overrides tab.
- Pick a component view (for example com_content → article), a module, or a layout.
- Joomla copies the original files into the template's
html/folder and confirms the path. - Find the new file under the Editor tab and start editing - or edit it locally in your IDE.
2.2 The Manual Way
The same thing by hand: copy the file from the component's tmpl folder into the mirrored path under your template's html/ folder:
cp components/com_content/tmpl/article/default.php \
templates/cassiopeia/html/com_content/article/default.php
The folder pattern is always: html/{extension}/{view}/{file} for components, html/{module}/{file} for modules.
2.3 A Tiny First Edit
Open your new default.php override and make a small, visible change - wrap the article text in an extra div, add a class, move the author line. Reload the page: your markup appears. Delete the override file and reload: the original returns. Once you have felt that loop - copy, edit, reload, delete restores - overrides stop being scary.
2.4 One Warning Before You Copy Everything
Only override what you actually change. Every override is a file you must maintain across updates (section 9). A template with fifty untouched override copies is not customised - it is fifty future maintenance tasks.
Back to top3. How Joomla Finds the Right File
3.1 The Lookup Order
For every view and module, Joomla checks a short list of locations and uses the first file it finds:
1. templates/{child}/html/... the active child template (if any)
2. templates/{parent}/html/... the parent template
3. {extension}/tmpl/... the extension's own layout (the default)
This order explains two important behaviours: a child template can override its parent's overrides, and an extension's own layout is simply the last resort. The active template style decides which template (and therefore which override set) is in play - a site can even use different templates on different menu items.
3.2 Naming is Everything
Overrides are matched purely by path and filename. html/com_content/article/default.php works; html/com_content/Article/default.php or html/content/article/default.php silently does nothing. When an override "does not work", the name or folder is wrong in nine out of ten cases.
3.3 Sublayouts: the Underscore Files
Look inside components/com_content/tmpl/article/ and you find default.php plus default_links.php. The underscore files are sublayouts, loaded from the main file with $this->loadTemplate('links'). They are overridden exactly like the main file - and they let you override just one fragment of a view instead of the whole thing. If your change is inside a sublayout, copy only that file and leave default.php alone: one less file to maintain.
4. Module Overrides and Chrome
4.1 Module Layout Overrides
Modules follow the same pattern with one level less nesting: html/mod_articles_news/default.php overrides the news module's layout. Many modules also offer a Layout dropdown in their advanced options; every file you add to the override folder with its own name (say cards.php) appears there as a selectable layout. That gives you per-module-instance layouts: two instances of the same module, two different presentations.
4.2 What Chrome Is
Chrome is the wrapper around a module: the box, the title tag, the surrounding classes. It is separate from the module's own layout, and it is defined by small files in layouts/chromes/. Joomla core ships four:
| Chrome | Output |
|---|---|
none |
The bare module output, no wrapper at all. |
html5 |
A configurable HTML5 wrapper with heading options. |
outline |
A debug frame showing the position name (used by ?tp=1 position preview). |
table |
Legacy table wrapper. |
Cassiopeia adds its own card and noCard chromes in html/layouts/chromes/ - which is also where your custom chrome goes.
4.3 Building a Custom Chrome
Create templates/{template}/html/layouts/chromes/hero.php, and the chrome name hero becomes available wherever chrome is chosen: in the template's index.php (<jdoc:include type="modules" name="banner" style="hero" />) and in each module's Advanced → Module Style option. A chrome file receives the module object and its parameters and simply prints the wrapper around $module->content. One small file, and every module on the site can opt in to your new box design.
5. Layout Overrides (JLayout)
5.1 The Shared Layouts
Beyond components and modules, Joomla keeps a library of shared layouts in the root layouts/ folder: pagination, custom fields rendering, edit form pieces, buttons, icons. Core code renders them through the LayoutHelper class:
use Joomla\CMS\Layout\LayoutHelper;
echo LayoutHelper::render('joomla.content.info_block.author', ['item' => $this->item]);
5.2 Overriding a Shared Layout
The dot notation maps to a path, and the override mirrors it under html/layouts/:
layouts/joomla/content/info_block/author.php original
templates/{template}/html/layouts/joomla/content/info_block/author.php override
Layout overrides are powerful because shared layouts appear everywhere: override the custom fields layout once (layouts/joomla/content/fields.php and friends) and every component that renders fields picks it up. The same reach makes them worth extra care - test more than one page type after changing a shared layout.
5.3 Choosing the Right Level
The same visual change can often be made in a component override, a module override, or a layout override. Rule of thumb: override at the narrowest level that covers your goal. One article view? Component override. One module instance? A named module layout. A pattern repeated across the site (pagination, field output)? That is what layout overrides are for.
Back to top6. Alternative Layouts
6.1 A Named Override Becomes a Choice
Copy an override file under a new name - say mycard.php instead of default.php - and Joomla does not use it automatically. Instead it appears as an alternative layout in dropdowns: an article's Options → Layout, a category's list layout, a module's layout setting. You choose per item, per category, per menu item, or per module which layout runs.
6.2 Menu Item Layouts Need the XML
To offer an alternative layout as a menu item type (a new entry next to "Single Article" in the menu wizard), pair the PHP file with an XML metadata file of the same name (mycard.php + mycard.xml). The XML follows the pattern of the core default.xml in the view's tmpl folder: a title, a description, and the request fields the view needs. Without the XML, the layout is item-selectable but not menu-selectable.
6.3 What Alternative Layouts Solve
They end the era of "if article X, do something else" hacks inside one bloated override. A news article, a recipe, and a landing page can each get their own layout file, cleanly selected in the content itself - one file per presentation, no conditionals.
Back to top7. Overrides in Child Templates
7.1 Why Overrides Belong in a Child
Since Joomla 4.1, templates can have child templates, and Cassiopeia supports them out of the box. The parent ships the machinery; the child holds your changes: style settings, custom CSS, and overrides. When the parent template is updated, your child - and every override in it - survives untouched. If you build on Cassiopeia today, put your overrides in a child, not in Cassiopeia itself.
7.2 How the Lookup Treats Children
As section 3 showed, the child's html/ folder is checked before the parent's. The practical consequences:
- A child override wins over the same override in the parent.
- The child only needs the files you change; everything else falls through to the parent and then to core.
- Moving an existing site to a child template is mostly moving the
html/folder and the custom CSS.
7.3 Assets Live in media/
Since Joomla 4.1 template assets (CSS, JS, images) live under media/templates/site/{template}/ rather than inside the template folder. Overrides that load assets should use the Web Asset Manager or HTMLHelper::_('stylesheet', ...) with relative paths, so the child/parent fallback also works for the assets themselves.
8. Real-World Override Recipes
8.1 Change the Article Info Line
Goal: show "By Jane, 3 May 2026" instead of Joomla's full info block. Override the info block layout (layouts/joomla/content/info_block/) or, for full control, the article view's default.php, and print exactly the fields you want from $this->item. Narrowest level: the info block layout, because it also fixes category and featured views.
8.2 Blog Cards for One Category
Goal: one category shows articles as image cards, the rest stay standard. Create an alternative layout for the category blog view (html/com_content/category/cards.php + cards_item.php), then select it in that category's options or in the menu item. No conditionals, no effect on other categories.
8.3 Restyle Every Module Box
Goal: consistent module styling site-wide. Write one custom chrome (section 4.3) and set it as the default module style in the template options or per position in index.php. Changing one chrome file later restyles every module that uses it.
8.4 Custom Fields, Custom Markup
Goal: render a "price" custom field as a styled badge. Override the field rendering layout (layouts/joomla/content/fields.php renders the list; individual field types render via plugins/fields/{type}/tmpl/, overridable as html/plg_fields_{type}/). Narrow version: override only the one field type you restyle.
9. Surviving Updates: Override Maintenance
9.1 The Cost Nobody Mentions
An override is a snapshot of a core file at one moment in time. When a Joomla update improves the original - a bug fix, an accessibility improvement, a security-relevant escape call - your override keeps running the old code. Overrides do not break on updates; they silently fall behind, which is worse, because nothing looks wrong.
9.2 Joomla Tracks This For You
Few people know that Joomla records exactly this. After an update, the #__template_overrides table marks override files whose originals changed, and the template manager shows them as Updated Files ("Updated files to check") with the date of the change. The workflow:
- After every core update, open System → Site Templates → your template.
- Check the Updated Files list.
- For each file, compare your override with the new original (a diff tool makes this quick) and port the relevant changes into your override.
- Mark the entry as checked (Mark Checked), so the list stays meaningful.
9.3 Make Future Diffs Easy
- Keep overrides minimal: the fewer lines differ from the original, the faster every diff.
- Comment your changes (
// changed: moved author line), so future-you knows what to preserve. - Keep the site - or at least the template folder - in version control.
git diffafter an update answers most questions instantly. - Delete overrides you no longer need. The best maintenance is on files that do not exist.
10. Under the Hood (Developer View)
10.1 Where the Lookup Happens
Component views inherit from HtmlView, whose template search paths are seeded in this order: template override folder first, extension tmpl folder last. loadTemplate() walks those paths; the same happens for modules in the module helper and for layouts in LayoutHelper, which prepends templates/{template}/html/layouts to its include paths. That is the whole magic: an ordered list of folders.
10.2 Making Your Own Extension Overridable
You get overridability for free by following conventions:
- Put view layouts in
tmpl/{view}/default.php(components) ortmpl/default.php(modules). - Split large views into sublayouts (
default_items.php) so users can override fragments. - Ship a
default.xmlwith request metadata so your views can become menu item types - and users can add their own alternative layouts next to yours. - Render repeating patterns through
LayoutHelperwith a$basePath, so those layouts are overridable too.
10.3 Override Files are Display Code Only
An override runs inside the view, so $this is the view object: $this->item, $this->items, $this->params are your data. Two rules keep overrides healthy. First, no business logic: an override formats data it receives; it does not query the database or call models (that work belongs in a plugin or the model layer). Second, keep escaping intact: the originals wrap output in $this->escape() and htmlspecialchars() calls deliberately. Deleting them while restyling is how overrides introduce XSS holes into otherwise secure sites.
10.4 Overrides and Caching
Override output is cached exactly like the original output: page cache, and the module's own caching settings, apply unchanged. Remember this when an edited override "does not show up" - clearing System → Clear Cache is step one of override debugging, before doubting the file path.
Back to top11. Overrides and the Web Services API
Overrides are presentation, and the Web Services API skips presentation entirely: an API request for an article returns raw data from the model, so no component override, chrome, or layout override affects API output. If a headless frontend needs different "markup", that markup lives in the consuming application, not in Joomla overrides.
The API does touch templates at one point: template styles can be managed via REST (v1/templates/styles/site and v1/templates/styles/administrator), so provisioning tools can switch a site's active style - and with it, which template's override set is in use. The override files themselves are filesystem artefacts: deploy them with your normal deployment process (git, rsync), not through an API.
12. SEO and Metadata
Overrides are the sharpest SEO tool most Joomla site owners never use. Search engines read your markup, and overrides put every tag under your control: fix a template's heading hierarchy (one h1, sensible h2/h3 order in article and category views), remove wrapper bloat that buries content, and add semantic elements (article, time, figure) where the default output uses plain divs.
Structured data belongs here too: an override is the natural place to enrich output with schema.org attributes or JSON-LD for articles, events, or products - complementing what the core schema.org plugin provides. And because overrides also render custom fields, they let you place machine-readable data (prices, dates, ratings) in exactly the markup search engines expect. Test with the usual structured-data validators after such changes; a typo in schema markup is worse than no schema at all.
The same control makes overrides Joomla's main accessibility tool. Landmarks (nav, main, aside), corrected heading levels, labels properly connected to form fields, and a sensible focus order for keyboard users are all override work. Accessibility and SEO improve together here: the semantic markup that helps a screen reader is the same markup a search engine rewards, and both move you toward WCAG compliance.
13. Common Mistakes and Pitfalls
13.1 Editing the Core File Instead
Symptom: a customisation vanished after the last Joomla update.
Fix: the change was made in the extension's own tmpl file. Redo it as an override in the template's html/ folder, where updates cannot reach it - that is the entire point of the mechanism.
13.2 The Override That Does Nothing
Symptom: the override file exists, but the page ignores it.
Fix: check, in order: the exact folder and file name (section 3.2), whether the active template style is the template you edited (another style may be assigned to this menu item), whether a child template's own override wins, and finally clear the cache.
13.3 Overriding Everything "While You Are At It"
Symptom: the Updated Files list after a core update shows forty entries; nobody dares to touch any of them.
Fix: delete every override that is identical to its original (a diff shows this in seconds). Keep only real changes, and prefer sublayout and layout overrides over full-view copies.
13.4 Stale Overrides After Updates
Symptom: a bug or accessibility issue that Joomla fixed months ago still appears on your site.
Fix: your override still contains the old code. Adopt the section 9 workflow: check Updated Files after each update and port changes into your overrides. For fixes with security impact, treat this as urgent, not cosmetic.
13.5 Business Logic in the Override
Symptom: an override runs database queries or calls models, and the site slows down or breaks when an extension updates.
Fix: move the logic to where it belongs - a plugin, a module, or the model - and let the override only format the data the view already has.
13.6 Lost Escaping
Symptom: after restyling an override, user-provided content renders as raw HTML.
Fix: restore the $this->escape() / htmlspecialchars() calls from the original file. Styling changes must never remove output escaping.
14. Best Practices
If you remember only a few things from this article, remember these:
- Never edit core or extension files; every markup change is an override in the template's
html/folder. - Use the Create Overrides tab so paths and names are always correct.
- Override at the narrowest level that solves the problem: sublayout before view, one field type before all fields.
- Put overrides in a child template, so parent template updates never touch them.
- Use alternative layouts instead of if-else constructions for different presentations of the same view.
- Check the Updated Files list after every Joomla update and port changes into your overrides.
- Keep overrides minimal, commented, and under version control; delete the ones you no longer need.
- Keep escaping intact, and keep business logic out of override files.
15. Quick Reference
PATHS component html/com_content/article/default.php
module html/mod_menu/default.php
layout html/layouts/joomla/content/info_block/author.php
chrome html/layouts/chromes/mychrome.php
LOOKUP child html/ > parent html/ > extension tmpl/
matched by exact path + filename, first hit wins
CREATE System > Site Templates > template > Create Overrides
manual: cp from tmpl/ to html/ mirrored path
SUBLAYOUT default_links.php = loadTemplate('links')
override fragments, not whole views
ALTERNATIVE copy with new name (mycard.php) = selectable layout
+ mycard.xml with metadata = menu item type
CHROME core: none, html5, outline, table
cassiopeia: card, noCard
custom chrome file = new "Module Style" option
MAINTAIN after each update: template > Updated Files list
(#__template_overrides tracks changed originals)
diff override vs new original > port > Mark Checked
RULES display code only - no queries, no models
keep $this->escape() intact
cache cleared before path-doubt debugging
API overrides do not affect API output (raw data)
v1/templates/styles/site manages active style only
DEV tmpl/ + default.xml + sublayouts + LayoutHelper
= your extension is fully overridable
Back to top16. Summary
Template overrides are Joomla's answer to the oldest CMS dilemma - customise or stay updatable - and they let you do both:
- The mechanism: a copied file in the template's
html/folder wins over the original; the lookup runs child template, parent template, extension. - Four kinds: component view overrides, module overrides, shared layout (JLayout) overrides, and chrome for the boxes around modules.
- Alternative layouts turn named overrides into per-item, per-category, and per-menu choices - with an XML file, even into menu item types.
- Child templates keep your overrides safe from parent updates; assets follow the same fallback via
media/templates/. - Maintenance is the real craft: the Updated Files list (backed by
#__template_overrides) tells you which overrides fell behind after each update - check it, diff, port, mark checked. - Discipline: minimal overrides, no business logic, escaping intact, version control.
Master overrides and Joomla changes character: from a CMS whose output you accept to one whose output you author, without ever losing the ability to update.
If your site carries years of accumulated overrides - some stale, some abandoned, some quietly missing the security and accessibility fixes of a dozen core updates - an override audit is one of the most rewarding small projects there is: diff everything, delete the dead weight, modernise what remains. It is precisely the kind of structured cleanup a Joomla specialist can do in a day, and the site is faster, safer, and easier to update afterwards.
Back to top

Peter is a Joomla specialist and a Linux admin for fast, secure and scalable websites.












