-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ContentHelperRoute::getCategoryRoute -> minor bug in categories URLs #20527
Comments
Also - not sure about this - but what about in the case of a missing $layout for a category to default to the categories/global params? |
I think we already have a PR for this, can't remember which one |
closed as fixed by #20229 |
Set to "closed" on behalf of @franz-wohlkoenig by The JTracker Application at issues.joomla.org/joomla-cms/20527 |
Thanks folks... my memory is not what it was... ;) |
I searched for this, but didn't find anything at first place. Now reading #20229 |
Steps to reproduce the issue
I noticed a minor issue in mod_articles_categories module, for the Categories URLs, because of the way
ContentHelperRoute::getCategoryRoute
handles the$layout
from$jinput
.Not sure if this bug appears anywhere else where
ContentHelperRoute::getCategoryRoute
is called, but for the mod_articles_categories we get URLs like below in cycles, depending from where we view the categories and when there is no menu-item for those categories to define a layout.Notice that the layout param in the first occasion is just empty, which with SEF on it ends up to URLs like below:
/blog/nature/16-animals?layout=
/blog/nature/16-animals
To reproduce this, create an articles categories module for a category tree e.g. you have a blog category and subcategories. Create menu items for the parent categories and just let the children without menu items. Place the module in all pages (articles, featured items and even other component), so to make sure there isn't a
$layout
for the categories view defined.Start clicking on your module's categories links from your various pages and you will notice the non-constant URLs.
Expected result
Categories URLs should be the same for the same categories.
Actual result
Categories URLs toggles as described above, depending on the $layout param.
System information (as much as possible)
Joomla 3.8.7
Additional comments
The issue appears to be in the way
ContentHelperRoute::getCategoryRoute
deals with the layout param from$jinput
At line 85, it does a strict comparison for
$layout !== ''
and if it's not, then it appends it to the URL. But this is not always the case, as I don't know about other cases, in those that I tested it out, $layout came back as null. So the $layout !== '' results to true.I think that unless we are expecting a layout to equals to "0", we could go with:
if (!empty($layout))
The text was updated successfully, but these errors were encountered: