Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
daksh1403 wants to merge 9 commits into python:master
base: master
Choose a base branch
Loading
from daksh1403:fix/docs-edit-button

Conversation

@daksh1403
Copy link

@daksh1403 daksh1403 commented Jan 11, 2026

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

Copy link
Collaborator

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.

wyattscarpenter and A5rocks reacted with thumbs up emoji

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[docs]: The "Edit Page" button is not visible in the documentation for the stable branch.

AltStyle によって変換されたページ (->オリジナル) /