No Code Attached Yet
avatar uzielweb
uzielweb
30 Oct 2025

Feature Request/Bug Fix: Improve SEF URL Handling with Filters in com_tags

Summary

This suggestion addresses an issue in the Joomla Tags component (com_tags) to enhance SEF (Search Engine Friendly) URL generation when using filters:

  • Malformed SEF URLs with Filters: When accessing tags via a menu item with pre-selected filters, the resulting URLs include query parameters (e.g., ?types[0]=1&tag_list_language_filter=en-GB) instead of being properly rewritten by mod_rewrite. This deviates from the standard behavior in nested requests for com_content, where filters are cleanly integrated into the URL path without additional segments or query strings, preserving the base menu item URL.

This change would improve SEO, user experience, and consistency across Joomla's core components.

Detailed Description

SEF URL Issue with Filters

Current Behavior

  • Menu items linked to the Tags component (e.g., a "Recent Publications" menu item with filters like type and language) generate URLs that append query strings for active filters.
  • Example malformed URL: /en/recent-publications/e-books?types[0]=1&tag_list_language_filter=en-GB
  • This occurs because the SEF router does not fully process filter states in nested tag views, unlike com_content where mod_rewrite strips and rewrites query params into path segments (e.g., /category/subcategory?filter=active becomes /category/subcategory without exposing filter details in the URL).

Expected Behavior

  • Align with com_content's SEF handling: Use mod_rewrite to incorporate filter values internally without altering the visible URL path, resulting in a clean base URL like /en/recent-publications/e-books (no additional segments or query params).
  • This would require updates to the com_tags router (router.php) to parse and build filter-aware segments internally, similar to Joomla\CMS\Component\Content\Router\Router::build(), while keeping the external URL unchanged.

Reproduction Steps

  1. Create a menu item of type "Tagged Items" (Tags > List all tags) with pre-applied filters (e.g., via module params or menu item options: types[0]=1, tag_list_language_filter=en-GB).
  2. Assign it a SEF alias (e.g., /en/recent-publications/e-books).
  3. Access a specific tag under this menu item.
  4. Observe the generated URL includes raw query params instead of the clean base path.

Impact

  • Poor SEO due to query-heavy URLs
  • Inconsistent with other core components, leading to developer confusion
  • Potential issues with caching and router performance

Proposed Fix

  • Extend the build() method in components/com_tags/router.php to detect active filters from the menu item's state and handle them internally without appending to the URL.
  • Leverage Joomla\CMS\Router\Router::createSEF() for consistency, ensuring the output remains /en/recent-publications/e-books regardless of filters.
  • Test against Apache (mod_rewrite) and Nginx equivalents.

Additional Context

  • Joomla Version: Tested on Joomla 5.x (but likely affects 6.x as well)
  • Environment: Apache 2.4+ with mod_rewrite enabled; PHP 8.4+
  • Related Issues/PRs:
    • Similar SEF fixes in com_tags: #42208
  • Priority: Medium (improves core usability without breaking changes)
avatar uzielweb uzielweb - open - 30 Oct 2025
avatar joomla-cms-bot joomla-cms-bot - change - 30 Oct 2025
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 30 Oct 2025

Add a Comment

Login with GitHub to post a comment