Add source-file path and raw-source link to page footer#46
Merged
Conversation
why: readers benefit from seeing which source file backs each page and having a machine-readable link to the raw content on GitHub. what: - Add conditional page-source div to footer left-details in page.html - Display source path (e.g. docs/index.md) with raw-source link - Guard on theme_source_repository and page_source_suffix so generated pages (genindex, search) are excluded - Add CSS for .page-source styling in footer.css
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #46 +/- ##
=======================================
Coverage 91.82% 91.82%
=======================================
Files 220 220
Lines 17776 17776
=======================================
Hits 16322 16322
Misses 1454 1454 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
why: document the new footer feature for the unreleased changelog what: - Add What's new entry for source-path and raw-source link (#46)
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
docs/configuration.md) and a "Raw source" link pointing to the raw file on GitHubtheme_source_repositoryandpage_source_suffixso it only appears on content pages — generated pages like genindex and search are excluded automaticallyDesign decisions
source_repository,source_branch, andsource_directory— all already declared intheme.confand wired throughmerge_sphinx_config(). No new configuration surface needed.page_source_suffixas the guard: Sphinx leaves this variable falsy for generated pages, providing a natural exclusion mechanism without maintaining a hardcoded page-name list./raw/URL path: GitHub's/raw/{branch}/{path}endpoint serves the unprocessed source file, matching the "machine-readable" intent. GitLab supports a similar endpoint at the same path segment.Verification
Verify the source line appears on content pages:
$ grep -c "page-source" docs/_build/html/index.htmlVerify the source line does not appear on generated pages:
$ grep -c "page-source" docs/_build/html/genindex.htmlTest plan
uv run pytest— all existing tests passSource: docs/index.md · Machine-readable: Raw sourcein footer on content pagesgenindex.htmlandsearch.htmlhave no source line/raw/main/docs/...)