Skip to content

Conversation

@daksh1403
Copy link

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

@daksh1403 daksh1403 force-pushed the fix/docs-edit-button branch from db3c671 to a5b166b Compare January 11, 2026 11:29
@sterliakov
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.

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.

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

2 participants