[BUGFIX] Exclude orphan pages from next/prev navigation#1138
Merged
linawolf merged 2 commits intoTYPO3-Documentation:mainfrom Dec 30, 2025
Merged
Conversation
Orphan pages marked with :orphan: directive should not appear in next/previous navigation links. This fixes the issue where: - Normal pages had "Next" links pointing to orphan pages - Orphan pages like mainMenu.json.rst were included in navigation sequence, causing 404 errors when navigating The fix adds a helper method isOrphanDocument() and modifies getPagerLinks() and getPrevNextLinks() to: 1. Not show next/prev links on orphan pages 2. Not include orphan pages as next/prev targets Resolves: TYPO3-Documentation#1137
Member
|
Let us merge this for now and test it out |
linawolf
approved these changes
Dec 30, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes the issue where orphan pages (marked with
:orphan:directive) are incorrectly included in the next/previous navigation chain, causing broken navigation links.Resolves: #1137
Changes
Core Fix (
TwigExtension.php)isOrphanDocument()helper method to detect if a document entry corresponds to an orphan pagegetPagerLinks()to:getPrevNextLinks()to:Test Updates
Updated expected output files to reflect the corrected behavior:
next-prev-by-toctree/expected/i.html- orphan page no longer has prev/next linksnext-prev-by-toctree/expected/three/pi.html- orphan page no longer has prev/next linksnext-prev-by-toctree/expected/four.html- no longer links to orphani.htmlchangelog/expected/Index.html- no longer links to orphanChangelog-12.htmlchangelog/expected/Changelog/12.0/Index.html- no longer has prev link to orphanmain-menu-json/expected/index.html- no longer links to orphanmainMenu.json.htmlTest Plan
vendor/bin/phpunit --filter next-prev-by-toctreepassesvendor/bin/phpunit tests/Integration/IntegrationTest.phppasses (108 tests, all assertions pass)Before/After
Before: Clicking "Next" on docs.typo3.org/Home/Overview.html leads to WikiLanding.html → mainMenu.json.html (404)
After: Orphan pages are excluded from navigation chain, preventing broken links