Docs: Fix duplicate search results by moving versioned docs out of docs_dir#16371
Conversation
|
@MaxNevermind do you mind verifying this? |
I missed this question from yesterday and worked on my own fix for it today 😆 - https://github.com/apache/iceberg/compare/main...MaxNevermind:iceberg:fix-change-default-docs-version?expand=1 Anyway, my solution is shorter but it is more like a workaround implemented through exclusions and your solution actually addresses a root cause. I checked out your branch and it seems to work alright. |
|
btw |
|
Thanks for taking a look @MaxNevermind We still need to fix the latest/nightly default issue. Could you repurpose your branch to just include the ordering swap and index fix? |

Problem
Every versioned documentation page appears twice in the site search index.
The root cause is that versioned doc sources live inside the parent MkDocs
project's
docs_dir(site/docs/docs/<ver>/docs/). This causes MkDocs toscan them directly and the
mkdocs-monorepo-pluginto inject them at theircanonical URLs — producing two rendered pages and two search entries per page.
See #16368 (review)
Solution
Move the versioned docs worktree from
site/docs/docs/(insidedocs_dir) tosite/versioned-docs/(outsidedocs_dir). Since the worktree is generated atbuild time by
dev/common.sh, this is purely a path change in build scripts andnav configs — no content changes.
With versioned sources outside
docs_dir, MkDocs' own file scanner never seesthem. Only the monorepo plugin renders them at their canonical URLs
(
docs/<ver>/<page>/), eliminating the duplicate entries entirely.Verified locally:

showing only 1 result
Changes
site/dev/common.sh— worktree created atversioned-docs/instead ofdocs/docs/site/nav.yml,site/mkdocs-dev.yml—!includepaths updatedsite/README.md— documentation updated to reflect new layout.gitignore— ignore rule updated (site/docs/docs/→site/versioned-docs/)