Skip to content

fix: dead link for packages with only private submodules#44

Merged
zzstoatzz merged 1 commit into
mainfrom
fix/nav-init-leaf-deadlink
Jun 22, 2026
Merged

fix: dead link for packages with only private submodules#44
zzstoatzz merged 1 commit into
mainfrom
fix/nav-init-leaf-deadlink

Conversation

@zzstoatzz

Copy link
Copy Markdown
Owner

Found while auditing Prefect's regenerated docs for dead links (follow-up to #42, #43).

A package whose only submodules are private (e.g. prefect.cli.deploy, whose children are all _-prefixed) is rendered as a leaf in the nav tree, but the generator writes it as a …-__init__.mdx page because those private submodules exist on disk. Navigation emitted the bare leaf path → 404.

The leaf branch now points at whichever file was actually written (prefers the plain page, falls back to -__init__ when only that exists; falls back to the plain name when neither exists, preserving unit-test behavior).

Verified: regenerating Prefect's full SDK reference with this build yields 0 dead links and 0 orphans across all 360 nav entries.

🤖 Generated with Claude Code

…dules

A package whose only submodules are private/internal is rendered as a leaf
in the navigation tree (its children aren't in generated_modules), but the
generator writes it as an "-__init__" page because those private submodules
exist on disk. Navigation then emitted the bare leaf path, producing a dead
link (e.g. prefect-cli-deploy in nav vs prefect-cli-deploy-__init__.mdx on
disk).

The leaf branch now points at whichever file was actually written: if the
plain page is absent but the -__init__ variant exists, use the latter. When
neither exists (e.g. pure unit tests with no files on disk) it falls back to
the plain name, preserving existing behavior.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant