PR-5.4-dev Pending

User tests: Successful: Unsuccessful:

avatar CSGoat0
CSGoat0
15 Apr 2026

Pull Request resolves #19453.

  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.

Summary of Changes

Modified the PageNavigation plugin to respect the Include Subcategories: All setting when generating article-to-article navigation (Next/Previous).

Previously, navigation only cycled through articles in the current category. Now, when a Category Blog menu item has Include Subcategories: All enabled, navigation includes articles from all subcategories as well.

File changed: plugins/content/pagenavigation/src/Extension/PageNavigation.php

Testing Instructions

  1. Create category structure:

    • Parent Category (e.g., "Parent Category")
    • Child Category under Parent Category (e.g., "Child Category")
  2. Create articles:

    • 2 articles in Parent Category
    • 2 articles in Child Category
  3. Create Category Blog menu item:

    • Select Parent Category
    • Blog Layout TabInclude Subcategories: All
    • Options TabNavigation: Show
  4. Test navigation:

    • Open frontend to the Category Blog page
    • Click into any article (Parent or Child)
    • Use Next and Previous navigation buttons
    • Verify you can navigate through all 4 articles (both parent and child categories)

Actual result BEFORE applying this Pull Request

Navigation only cycles through articles in the current category:

  • Viewing Parent Article → Next stops after Parent articles (does not reach Child articles)
  • Viewing Child Article → Previous stops before Parent articles

Expected result AFTER applying this Pull Request

Navigation cycles through all articles in the parent category AND all its subcategories:

  • Viewing Parent Article → Next continues into Child articles
  • Viewing Child Article → Previous goes back to Parent articles

Link to documentations

Please select:

  • Documentation link for guide.joomla.org:
  • No documentation changes for guide.joomla.org needed
  • Pull Request link for manual.joomla.org:
  • No documentation changes for manual.joomla.org needed
avatar CSGoat0 CSGoat0 - open - 15 Apr 2026
avatar CSGoat0 CSGoat0 - change - 15 Apr 2026
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 15 Apr 2026
Category Front End Plugins
avatar CSGoat0 CSGoat0 - change - 15 Apr 2026
Labels Added: PR-5.4-dev
avatar hiteshm0
hiteshm0 - comment - 15 Apr 2026

@CSGoat0
In my installation there is a category called Modules ( 2 articles ) which has multiple subcategories one of which is
Content Modules ( 12 articles ) and i can only navigate 14 articles using the next button [ The articles from the other subcategories are excluded ]

Another problem is that when i click next and i go from an article that belongs to Modules to an article that belongs to Content Modules i should see a prev button that takes me back to the article that belongs to Modules, but there is no prev button ( ie I can only cycle articles from Content Modules using the next and prev buttons)

perhaps it has to do something with the fact that all the articles mentioned above ( that belong to content modules category ) are menu items elsewhere themselves so the URL is resolving to reflect that.

avatar CSGoat0
CSGoat0 - comment - 15 Apr 2026

@CSGoat0 In my installation there is a category called Modules ( 2 articles ) which has multiple subcategories one of which is Content Modules ( 12 articles ) and i can only navigate 14 articles using the next button [ The articles from the other subcategories are excluded ]

Another problem is that when i click next and i go from an article that belongs to Modules to an article that belongs to Content Modules i should see a prev button that takes me back to the article that belongs to Modules, but there is no prev button ( ie I can only cycle articles from Content Modules using the next and prev buttons)

perhaps it has to do something with the fact that all the articles mentioned above ( that belong to content modules category ) are menu items elsewhere themselves so the URL is resolving to reflect that.

Hello @hiteshm0 , I have did those steps:

  • I created parent category (name: parent category).
  • I create 2 child category (names: child catgeory1, child category2).
  • I add some articles in child category1 and different some articles in child category2.
  • I navigated to the target menu and I could see all of them.
  • When I enter any of them I can see (Prev) and (Next) buttons except the first and last one (just one button either next or prev).
  • I could navigate from the last one to the first one and vise versa.

If you think I missed something, please tell me what I should do.
If that works for me as you expect but not for you, then I suggest to:

  • Delete both Cache files at administrator and frontend.
  • Refresh your Frontend.
avatar hiteshm0
hiteshm0 - comment - 16 Apr 2026

@CSGoat0
assign one of the child category articles as a single article menu item in a different menu.

Now try to access it from the parent category blog ( for which navigation is set to show ) you still can't see the prev and next buttons because you are using the current menu items URL ( $active = $menu->getActive();) which might have shifted contexts ( ie the context of the parent category blog might be lost ).

There is also a bigger problem that will be more difficult to solve.
If the single article menu item mentioned above has its options -> navigations explicitly set to hide instead of global then once you click next and get to that article you will lose both the prev and next button ( and the articles that were supposed to appear after it will not be accessible by navigating using those buttons )

avatar CSGoat0
CSGoat0 - comment - 16 Apr 2026

@CSGoat0 assign one of the child category articles as a single article menu item in a different menu.

Now try to access it from the parent category blog ( for which navigation is set to show ) you still can't see the prev and next buttons because you are using the current menu items URL ( $active = $menu->getActive();) which might have shifted contexts ( ie the context of the parent category blog might be lost ).

There is also a bigger problem that will be more difficult to solve. If the single article menu item mentioned above has its options -> navigations explicitly set to hide instead of global then once you click next and get to that article you will lose both the prev and next button ( and the articles that were supposed to appear after it will not be accessible by navigating using those buttons )

@hiteshm0
Thank you for the detailed testing and for identifying this edge case.

You're correct that when an article has its own single article menu item, the navigation context can be lost because $active changes. Solving this would require storing navigation state (e.g., in the session), which would introduce other issues like stucking on the same category blog and unable to view anything else due to the stored value.

Also, the URL solution is because the catid of the category blog menu unfortunately doesn't bind to the absolute parent category id (rather, just a random one). so, it will never work even in the base context.

Given those trade-offs, my fix addresses the primary use case: navigation within a Category Blog context when Include Subcategories: All is enabled. I believe this is an improvement over the current behavior.

I am open to discuss another solution if you have one in mind.
Thanks again for your thorough review!

avatar hiteshm0
hiteshm0 - comment - 16 Apr 2026

@CSGoat0
On a live site, most articles will be menu items one way or the other. This consistently works only when the articles are in the backend but not on the site in any way except for being part of the category blog.
And, you might get locked away from the parent category having access only to the articles from a child category through navigation. Which is just another bug.

We should wait for the opinion of someone more experienced

avatar CSGoat0
CSGoat0 - comment - 16 Apr 2026

@CSGoat0 On a live site, most articles will be menu items one way or the other. This consistently works only when the articles are in the backend but not on the site in any way except for being part of the category blog. And, you might get locked away from the parent category having access only to the articles from a child category through navigation. Which is just another bug.

We should wait for the opinion of someone more experienced

@hiteshm0
This is a limitation of how Joomla determines the active menu item.
The old implementation never allowed parent↔child navigation at all. This PR enables it for the majority of cases where articles don't have their own menu items.

I agree this edge case exists, but fixing it would require a more fundamental change to how Joomla tracks navigation context across menu items — which is outside the scope of this PR. I just enhanced the db Query.

And yes, you are right. Either case, an experienced maintainer should decide.

Add a Comment

Login with GitHub to post a comment