Joomla allows you to customize almost any feature through overrides.
Layout overrides are a type of override that enable you to customize small elements such as the article author or published date.
In this tutorial, I'll show you how to create a layout override for Joomla tags.
The image below shows how tags look by default in Joomla articles, using the Protostar template:
These tags are active links. In this example, I want to keep the tags but remove the links.
Step #1. Create a layout override
Let's copy some files from the Joomla core into our template, so we can customize them safely.
- Go to Extensions
- Templates
- Templates
- Find your template details & files
- Click the "Create Overrides" tab.
- Click on "content" in the Layouts column
This will generate a set of files in the /templates/your-template/html/layouts/joomla/content/ folder.
Step #2. Customize the tags layout
- Go back to the "Editor" tab
- Navigate to html > layouts > joomla > content > tags.php
Here you can change the code that renders the tags displayed on articles.
In this example, I want to remove the links and just leave the labels; you can change the code depending to your needs.
In lines 24 and 26, I switch the opening and closing <a> elements, and replace them with <span>.
This is how the code will look after my small change:
- Click "Save & Close" when you're done.
Step #3. End result
Visit one of your articles on front-end and see how the tags are still there, but are no longer links.
Learn more
Want to find out more about Joomla overrides. There are video classes about overrides in Joomlashack University.
You can also see examples of overrides in the Wright Framework, and our Joomla templates.