Repository navigation
Keep each entry's own title when a page is listed more than once in nav - #103
Merged
Merged
Conversation
When the same file was listed more than once in `nav`, every entry showed the title of the first one. Navigation reuses the page already attached to the file (so that plugins can provide their own `Page`), so the second entry got the same `Page` object and its configured title was dropped. The page also appeared twice in `Navigation.pages`, which scrambled the previous/next links. Repeated entries are now `PageAlias` objects: they have their own `title` and `parent`, and forward all other attributes to the page, so existing theme templates keep working. Aliases aren't part of `Navigation.pages`, so the page is built once and appears once in previous/next links. Co-Authored-By: Claude <[email protected]>
Contributor
Merging this PR will degrade performance by 12.21%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ❌ | test_get_yaml_loader |
316.5 µs | 360.5 µs | -12.21% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing fix/duplicate-nav-titles (73d2845) with main (7c41de6)
This was referenced Oct 31, 2026
Merged
Merged
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.
When the same file is listed more than once in
nav, every entry shows the title of the first one:Root cause: navigation reuses the page already attached to
File.page(so that plugins can provide their ownPagesubclass). The second entry therefore got the samePageobject, and its configured title was dropped. The page also appeared twice inNavigation.pages, which scrambled the previous/next links.Fix: repeated entries are now
PageAliasobjects (inmkdocs.structure.nav):title(falls back to the page's title if none is given innav) and ownparent;url,active,toc,meta,is_page, ...) is forwarded to the page, so existing theme templates work unchanged;Navigation.pages, so the page is built once and appears once in previous/next links.The first occurrence is still the page object itself, including pages provided by plugins.
Verified with both built-in themes: each entry shows its own title, the page's TOC is rendered once, and previous/next links are linear again. The theme developer guide documents
PageAliasunder "Navigation Objects".Related Issue
No issue in this repository.
Checklist
docs/about/release-notes.mdupdated (if applicable)🤖 Generated with Claude Code