Replace stable, 1.7.0, 1.9.0, master symlinks with HTML redirect stubs#84
Merged
malfet merged 1 commit intopytorch:sitefrom Apr 30, 2026
Merged
Replace stable, 1.7.0, 1.9.0, master symlinks with HTML redirect stubs#84malfet merged 1 commit intopytorch:sitefrom
malfet merged 1 commit intopytorch:sitefrom
Conversation
Follow-up to pytorch#83, applying the same symlink-to-stub conversion to the remaining aliases. With this PR every top-level alias under the docs site is a directory of small (~500B) HTML stubs instead of a symlink, so actions/upload-pages-artifact (which runs `tar --dereference --hard-dereference`) no longer expands aliases into duplicate byte copies. Aliases converted: - stable/ -> 2.11/ (2,883 stubs) - 1.7.0/ -> 1.7.1/ (800 stubs) - 1.9.0/ -> 1.9.1/ (1,649 stubs) - master/ -> main/ (3,470 stubs; replaces the prior symlinks-to- __redirect__.html scheme with per-page stubs) Each stub uses `location.replace(url + location.hash + location.search)` so anchor deep-links like `stable/torch.html#torch.cat` survive the redirect, with a `<meta http-equiv="refresh">` noscript fallback, `<link rel=canonical>`, and `robots: noindex` so search engines index the canonical version. Generated with `scripts/make_stubs.py --mirror-canonical`. Adds the companion skill doc at `scripts/redirect-stubs/SKILL.md` describing when and how to apply the conversion.
Contributor
Author
|
@claude can you review this PR ? |
malfet
reviewed
Apr 30, 2026
Contributor
malfet
left a comment
There was a problem hiding this comment.
After carefully reading all 3k+ files I conclude that "I'm going slightly mad"
4 tasks
stecasta
added a commit
to stecasta/docs
that referenced
this pull request
Apr 30, 2026
…l mode pytorch#84 left aliases (stable/, master/, 1.7.0/, 1.9.0/) without their non-HTML build artifacts. The script already has DEFAULT_KEEP = {"searchindex.js", "objects.inv", ".buildinfo"} and the default walk-alias mode honors it correctly. The bug: --mirror-canonical mode iterates iter_canonical_html() (filtered to .html), so keep-files are never copied. Net effect: https://pytorch.org/docs/stable/objects.inv now 404s, breaking intersphinx for every downstream Sphinx/mkdocstrings project (vllm, lightning, vision, audio, skorch, ...). This patch makes --mirror-canonical walk the full canonical and byte-copy keep-listed files. Default walk-alias mode unchanged. Verified locally: a synthetic canonical with HTML pages plus objects.inv/searchindex.js/.buildinfo now produces an alias dir with HTML stubs AND byte-identical copies of the three keep-files.
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
Follow-up to #83. Applies the same symlink-to-stub conversion to the remaining top-level aliases. After this PR no top-level alias under the docs site is a symlink, so
actions/upload-pages-artifact(which runstar --dereference --hard-dereference) no longer expands aliases into duplicate byte copies in the Pages artifact.What changed
stable2.111.7.01.7.11.9.01.9.1mastermainmaster/previously held one real__redirect__.htmlplus 2,153 symlinks pointing at it. That layout is replaced with proper per-page stubs that point at the matching canonical path undermain/, matching the format used for the other aliases.Also adds
scripts/redirect-stubs/SKILL.mddocumenting when and how to apply the conversion (the script itself,scripts/make_stubs.py, was added in #83).Stub format
Each stub uses
location.replace(url + location.hash + location.search)so anchor deep-links likestable/torch.html#torch.catsurvive the redirect. Crawler / no-JS fallbacks:How it was generated
Caveat
As in #83, the alias directories contain only
.htmlstubs — no_static/,_images/,searchindex.js, orobjects.inv. External deep-links to alias assets (e.g.pytorch.org/docs/stable/_images/foo.png) will 404. Clickable HTML links are unaffected — they redirect to the canonical version where the assets live.Test plan
pytorch.org/docs/stable/→ redirects topytorch.org/docs/2.11/.pytorch.org/docs/stable/torch.html#torch.cat→ lands on the#torch.catanchor under2.11/.pytorch.org/docs/1.7.0/→ redirects under1.7.1/.pytorch.org/docs/1.9.0/→ redirects under1.9.1/.pytorch.org/docs/master/torch.html→ redirects topytorch.org/docs/main/torch.html.find stable 1.7.0 1.9.0 master -name '*.html' -size +1kis empty.find stable 1.7.0 1.9.0 master -type lis empty.