PHP
Joomla! 6
Joomla! 5
Joomla! 3 (Legacy)
Template Override
Basic
Load and Render Article Tags in Overrides
Fetches tags attached to a Joomla article using TagsHelper and renders them via LayoutHelper or custom markup.
templates/seu_template/html/com_content/article/default.php
<?php
declare(strict_types=1);
use Joomla\CMS\Helper\TagsHelper;
use Joomla\CMS\Layout\LayoutHelper;
$tagsHelper = new TagsHelper();
$tags = $tagsHelper->getItemTags('com_content.article', (int) $this->item->id);
if (!empty($tags)) {
echo LayoutHelper::render('joomla.content.tags', $tags);
}
Uses namespaced TagsHelper with the core joomla.content.tags layout.
templates/seu_template/html/com_content/article/default.php
<?php
$tagsHelper = new JHelperTags();
$tags = $tagsHelper->getItemTags('com_content.article', $this->item->id);
$layout = new JLayoutFile('joomla.content.tags');
echo $layout->render($tags);
Legacy Joomla 3 code using JHelperTags and JLayoutFile.
Technical explanation and best practices
Inside custom modules or category layouts where $item->tags is not preloaded, call TagsHelper::getItemTags('com_content.article', $item->id) to retrieve published tags.