-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Fix "Edit Page" button visibility on stable branches #20562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
db3c671 to
a5b166b
Compare
|
Release branches do not receive any updates, they are carved in stone, so why should "edit page" link to branches other than master? User-visible 404 errors are bad, but receiving PRs against release branches for a file that no longer exists would be no less awkward. Hiding this button altogether for non-master docs sounds reasonable to me, but using other target branches does not. |
|
You've accidentally included many irrelevant changes in this PR, from your other PRs. |
|
It seems to me (from testing on my fork) that this also will result in 404s once we remove the stale release branches and rely entirely on tags as suggested in #19795. Since this seems to use the tag name to send to a github url that would correspond to a branch (and not a tag). So, I would recommend just closing this. And, independently closing #17947 as complete. |
Replaces the hardcoded source_branch = "master" in conf.py with dynamic branch detection.
Rationale The "Edit on GitHub" button currently links to master regardless of the active branch. This causes broken links (404s) or hides the button entirely when viewing documentation for stable release branches (e.g., release-1.13) where file paths or content may differ.
Implementation Details
The source_branch is now resolved in the following order:
Read the Docs: Checks os.environ["READTHEDOCS_GIT_IDENTIFIER"].
Local Dev: Falls back to git rev-parse --abbrev-ref HEAD.
Fallback: Defaults to "master" on error.
Fixes #17947