Joomla Template: How to Create a Basic Template Step by Step

Last updated on 20 Nov 2026
Joomla template: a developer assembles a website layout from building blocks
One folder, three files, and Joomla displays your own layout instead of the default one. Creating a basic Joomla template is less daunting than it looks, as long as you know which files the CMS expects and where it looks for them. And since Joomla 4, those rules have changed: many tutorials online still describe the Joomla 3 method.

This tutorial explains step by step how to create a Joomla template from scratch for Joomla 5 and Joomla 6: what a Joomla template does, the folder structure, the index.php, templateDetails.xml and joomla.asset.json files, installation, module positions, and faster alternatives such as a Cassiopeia child template. A generator prepares the templateDetails.xml file for your future template.

At a glance

  • A Joomla template defines the structure and look of your site, not its content.
  • The minimum to create a Joomla template: templateDetails.xml, index.php and a stylesheet declared in joomla.asset.json.
  • Since Joomla 4.1, a template’s CSS, scripts and images live in media/templates/site/template-name.
  • To customize a site without coding everything, a Cassiopeia child template is often enough and survives updates.
  • Joomla 6 is the version to use in 2026: Joomla 5 now only receives security fixes.

What is a Joomla template for?

A Joomla template is the set of files that controls how your site’s content is displayed: the HTML structure of the page, where menus and modules sit, the styles, fonts and scripts. The content itself stays in the database. Switching templates changes the look of the whole site without touching the articles.

Setting up a basic template does not mean the design is finished. It means the structure needed to display the site exists: a header, a content area, module positions. The visual work comes next, in the stylesheet.

Joomla distinguishes site templates (the public side, Cassiopeia by default) from administrator templates (Atum). This tutorial covers a site template.

The structure of a Joomla template in 2026

Location File or folder Role
templates/mysite/ templateDetails.xml required declares the template, its files, media and positions
templates/mysite/ index.php required layout shared by every page
templates/mysite/ joomla.asset.json recommended declares CSS and scripts for the Web Asset Manager
templates/mysite/ error.php, offline.php, component.php optional error page, offline site, simplified view
templates/mysite/html/ overrides optional custom output for components and modules
media/templates/site/mysite/ css/, js/, images/ required template stylesheets, scripts and images
File structure of a Joomla template in Joomla 4.1 and later (Joomla 5 and 6).

Since Joomla 4.1, “static” files (CSS, JavaScript, images, fonts) no longer live in the template folder but in media/templates/site/template-name/. PHP files stay in templates/template-name/. This is what makes child templates possible, and it is the first source of errors when following an old tutorial.

Steps to create a basic Joomla template

1

Create the folderstemplates/mysite/ for PHP files, media/templates/site/mysite/css, js and images for media.
2

Write templateDetails.xmlname, version, author, file list, media folder and module positions.
3

Write index.phpHTML5 skeleton and jdoc:include tags for the head, component, messages and modules.
4

Declare the stylesjoomla.asset.json points to template.css, enabled in index.php with useStyle().
5

Install the templatezip installed from System, Install, or files copied then System, Discover.
6

Enable and test itset it as the default style, place modules in positions, check on mobile.
Steps to create a basic Joomla template.

The core files of a Joomla template in detail

1) The templateDetails.xml file

This is the template’s ID card. Joomla reads it to install the template, list it in the administrator and know its files, media folders, module positions and parameters. Without it, the template does not exist as far as Joomla is concerned.

<?xml version="1.0" encoding="utf-8"?>
<extension type="template" client="site">
  <name>mysite</name>
  <version>1.0.0</version>
  <author>Your name</author>
  <inheritable>1</inheritable>
  <files>
    <filename>index.php</filename>
    <filename>joomla.asset.json</filename>
    <filename>templateDetails.xml</filename>
    <folder>html</folder>
  </files>
  <media destination="templates/site/mysite" folder="media">
    <folder>css</folder>
    <folder>js</folder>
    <folder>images</folder>
  </media>
  <positions>
    <position>menu</position>
    <position>sidebar-right</position>
    <position>footer</position>
  </positions>
</extension>

The inheritable tag allows child templates to be built from yours. The positions block lists the places where modules can be assigned from the administrator.

2) The index.php file

This is the layout shared by every page of the site. It holds the HTML skeleton and jdoc:include tags that Joomla replaces with real content: the head (title, meta, CSS, scripts), system messages, the component (the article or page being shown) and the modules in each position.

<?php
defined('_JEXEC') or die;
$wa = $this->getWebAssetManager();
$wa->useStyle('template.mysite');
?>
<!DOCTYPE html>
<html lang="<?php echo $this->language; ?>">
<head>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <jdoc:include type="metas" />
  <jdoc:include type="styles" />
  <jdoc:include type="scripts" />
</head>
<body>
  <header><jdoc:include type="modules" name="menu" style="none" /></header>
  <main>
    <jdoc:include type="message" />
    <jdoc:include type="component" />
  </main>
  <aside><jdoc:include type="modules" name="sidebar-right" style="card" /></aside>
  <footer><jdoc:include type="modules" name="footer" style="none" /></footer>
</body>
</html>

The first line blocks direct access to the file. The jdoc:include type="metas", styles and scripts tags replace the single head tag of Joomla 3. Add error.php (error page), offline.php (site in maintenance) and component.php (print view or modal window) as needed.

3) The css/template.css file and joomla.asset.json

In Joomla 3, you added the stylesheet with a simple link tag in index.php. Since Joomla 4, CSS and scripts go through the Web Asset Manager: you declare them in joomla.asset.json, then enable them in index.php with useStyle() or useScript(). Joomla then handles load order, dependencies and versioning.

{
  "$schema": "https://developer.joomla.org/schemas/json-schema/web_assets.json",
  "name": "mysite",
  "version": "1.0.0",
  "assets": [
    { "name": "template.mysite", "type": "style", "uri": "template.css" }
  ]
}

The template.css file itself goes in media/templates/site/mysite/css/. Start mobile first: a single column on phones, the sidebar next to the content once the screen is wide enough.

Need a custom Joomla template without spending your evenings on it? Our team can build it for you

Generator: prepare your templateDetails.xml file

Generate the base of your templateDetails.xml file (nothing is saved)

Install and enable your template

Two methods. First: zip the template folder (with templateDetails.xml at the root of the zip and a media folder) and install it from System, Install, Extensions. Second, handy during development: copy the files straight to the server, then use System, Discover so Joomla picks it up.

Then open System, Site Template Styles, and set your template’s style as the default. To see where positions sit on a page, turn on “Preview Module Positions” in the template options, then add ?tp=1 to the page address.

Child template or a template built from scratch?

Since Joomla 4.1, a child template inherits every file from its parent and only contains what you change. Created in one click from Cassiopeia (the “Create Child Template” button), it lets you change colors, fonts, logo and a few overrides without touching the original template, which keeps receiving Joomla updates.

Our advice: for a brochure site that stays close to Cassiopeia, start from a child template. Build a template from scratch when the layout is truly specific, or when you want minimal code you fully control. Template frameworks and builders from the big Joomla template vendors are a third route, faster but heavier.

Joomla child template: customizing colors and layout without editing the parent template

Template overrides

An override changes how a component or module is displayed without touching the Joomla core. From the administrator (System, Site Templates, “Create Overrides” tab), pick for example com_content then article: Joomla copies the layout file into your template’s html folder, and you edit that copy. Overrides survive updates, but compare them after a major release: Joomla flags those whose original has changed.

Best practices: responsive, performance, SEO and accessibility

  • Responsive: the viewport tag, CSS grid or flexbox, images with declared dimensions.
  • Performance: few scripts, locally hosted fonts, WebP images.
  • SEO: a single H1 per page (the content’s), suitable heading tags for module titles, breadcrumbs, and the lang attribute on the html element.
  • Accessibility: sufficient contrast, visible keyboard focus, a skip link to the content, semantic landmarks (header, nav, main, footer).
  • Security and maintenance: the defined('_JEXEC') or die; line in every PHP file, and no direct edits to Cassiopeia, which the next update overwrites.

Responsive Joomla template tested on desktop, tablet and smartphone

Which Joomla version for a new template?

Joomla 6 was released on October 14, 2025 and will be maintained until October 2029. Joomla 5 has received no bug fixes since October 13, 2026 and gets no security fixes after October 12, 2027. Joomla 4 and Joomla 3 are end of life. A template written for Joomla 4 or 5 following the rules in this tutorial works in Joomla 6; a Joomla 3 template must be rewritten. If you are weighing a move away from Joomla, see our guide on how to migrate Joomla to WordPress.

Common mistakes

  • Following a Joomla 3 tutorial: single jdoc head tag, CSS in the template folder, JFactory calls.
  • Editing Cassiopeia directly, and losing your changes at the next update.
  • Forgetting a position in templateDetails.xml: the module exists but shows up nowhere.
  • Loading CSS with a link tag instead of the Web Asset Manager, which breaks load order.
  • A badly built zip: templateDetails.xml in a subfolder, and the installation fails.

Wrapping up

Creating a basic Joomla template takes a handful of files: templateDetails.xml for the declaration, index.php for the layout, joomla.asset.json and template.css for the styles. Follow the new media layout, declare your positions, test on mobile, and you will have a clean base to build on. If the goal is mostly to customize the look, start with a child template: it is faster and safer over time.

Frequently asked questions about creating a Joomla template

What is a Joomla template?

It is the set of files that defines the structure and look of a Joomla site: HTML layout, module positions, styles and scripts. Content stays in the database, so switching templates changes how the whole site is displayed without touching the articles. Joomla ships Cassiopeia as the default site template.

Which files are required to create a Joomla template?

At minimum templateDetails.xml, which declares the template, and index.php, which holds the layout. In practice you add joomla.asset.json to declare stylesheets and scripts, a template.css file in the media folder, and often error.php, offline.php and component.php. The html folder holds overrides.

Should you build a Joomla template from scratch or use a child template?

To customize a site close to the Cassiopeia design, a child template is the best choice: quick to create, it inherits the parent’s updates. A template from scratch makes sense for a very specific layout or minimal, fully controlled code. Both approaches follow the same file rules.

What is a template override in Joomla?

It is a copy of a component or module layout file, placed in the template’s html folder and edited to change the output without touching the Joomla core. You create it from the template manager. Overrides survive updates, but should be checked after a major release.

How do you make a Joomla template responsive and fast?

Add the viewport tag, build the layout with CSS grid or flexbox starting from mobile, and load styles and scripts through the Web Asset Manager. Keep scripts to a minimum, host fonts locally and serve light WebP images. Then measure the result with PageSpeed Insights on mobile.

Joomla, WordPress or Drupal: which CMS should you choose in 2026?

Joomla remains solid for multilingual sites and sites with varied access rights, with a rich core that needs few extensions. WordPress wins on ecosystem and ease of use for editors, Drupal on complex, high-volume projects. The right choice depends mostly on who will maintain the site and which features are needed.

Our sources