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.

@wyattscarpenter
Copy link
Contributor

wyattscarpenter commented Jan 18, 2026

You've accidentally included many irrelevant changes in this PR, from your other PRs.

@wyattscarpenter
Copy link
Contributor

wyattscarpenter commented Jan 18, 2026

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.

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.

3 participants