User tests: Successful: Unsuccessful:
Pull Request resolves #40668.
This PR fixes a routing bug in com_tags where the types[] parameter (content type filter) is incorrectly appended as a query string to SEF URLs instead of being properly absorbed by the router.
Current problematic behavior: When a menu item of type "Tagged Items" has one or more content types selected (e.g., Article, Contact, News Feed), the types[] parameters are appended to the URL as query strings.
Examples of the bug:
/tags/exhibitions?types[0]=1/tags/exhibitions?types[0]=1&types[1]=2Solution: The router now compares the types[] parameters in the URL against the content types configured in the menu item. If they match exactly, the parameters are removed from the URL since they are redundant (the menu item already stores this information). This follows the same pattern already used for comparing tag IDs in the router.
Modified file: components/com_tags/src/Service/Router.php
Follow these steps on a fresh Joomla installation:
1. Enable SEF URLs
htaccess.txt to .htaccess if needed (or configure your local server environment)2. Create a tag
3. Create content items
4. Create the menu item
5. View the frontend
types[] parameter(s) appended:
?types[0]=1?types[0]=1&types[1]=26. The workaround (demonstrates this is a bug)
Test Case 1: Single content type (Article only)
?types[0]=1Test Case 2: Multiple content types (Article + Contact)
?types[0]=1&types[1]=2Test Case 3: Different single content type (Contact only)
?types[0]=2Test Case 4: No content types selected (all types)
Test Case 5: User override (preserves intentional overrides)
https://mysite.com/tags/exhibitions?types[0]=1&types[1]=2Test Case 1 (Single type - Article):
https://mysite.com/tags/exhibitions?types[0]=1
Test Case 2 (Multiple types - Article + Contact):
https://mysite.com/tags/exhibitions?types[0]=1&types[1]=2
Test Case 3 (Different single type - Contact only):
https://mysite.com/tags/exhibitions?types[0]=2
Test Case 4 (No types - all content types):
https://mysite.com/tags/exhibitions
(This case already works correctly)
The types[] parameters are appended as query strings regardless of how many content types are selected, making URLs unnecessarily long, less user-friendly, and inconsistent with Joomla's SEF URL patterns.
Test Case 1 (Single type - Article):
https://mysite.com/tags/exhibitions
Test Case 2 (Multiple types - Article + Contact):
https://mysite.com/tags/exhibitions
Test Case 3 (Different single type - Contact only):
https://mysite.com/tags/exhibitions
Test Case 4 (No types - all content types):
https://mysite.com/tags/exhibitions
Test Case 5 (User override - different from menu item):
https://mysite.com/tags/exhibitions?types[0]=1&types[1]=2
(Preserved because user explicitly requested different content types)
All URLs are clean and free of redundant types[] query parameters when they match the menu item's configuration. The content type filtering still works correctly because the menu item already stores this information in its parameters. User overrides are respected.
Please select:
| Status | New | ⇒ | Pending |
| Category | ⇒ | com_tags Front End |
| Labels |
Added:
PR-5.4-dev
|
||