PHP
Joomla! 6
Joomla! 5
Joomla! 3 (Legacy)
Template Override
Basic
Generate Friendly SEF URL for an Article Category
Generates the SEF URL for an article category using RouteHelper::getCategoryRoute() and Route::_().
templates/seu_template/html/com_content/article/default.php
<?php
declare(strict_types=1);
use Joomla\CMS\Router\Route;
use Joomla\Component\Content\Site\Helper\RouteHelper;
$catUrl = Route::_(RouteHelper::getCategoryRoute((int) $item->catid, (string) ($item->language ?? '*')));
echo htmlspecialchars($catUrl, ENT_QUOTES, 'UTF-8');
Uses RouteHelper::getCategoryRoute() with multilingual routing support.
templates/seu_template/html/com_content/article/default.php
<?php echo JRoute::_(ContentHelperRoute::getCategoryRoute($item->catslug)); ?>
Legacy Joomla 3 version using JRoute and ContentHelperRoute::getCategoryRoute().
Technical explanation and best practices
Ideal for turning category badges into clickable archive links inside articles, blog cards or custom modules.
Pass both catid and language in Joomla 5 and 6 to keep multilingual URL prefixes intact.