Skip to content

Add source-file path and raw-source link to page footer#46

Merged
tony merged 2 commits into
mainfrom
footer-docs-source
May 25, 2026
Merged

Add source-file path and raw-source link to page footer#46
tony merged 2 commits into
mainfrom
footer-docs-source

Conversation

@tony
Copy link
Copy Markdown
Member

@tony tony commented May 25, 2026

Summary

  • Add a source-file provenance line to every documentation page footer, showing the repo-relative path (e.g. docs/configuration.md) and a "Raw source" link pointing to the raw file on GitHub
  • Guard the new section on theme_source_repository and page_source_suffix so it only appears on content pages — generated pages like genindex and search are excluded automatically

Design decisions

  • Reuse existing theme options: The footer constructs its URL from source_repository, source_branch, and source_directory — all already declared in theme.conf and wired through merge_sphinx_config(). No new configuration surface needed.
  • page_source_suffix as 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.html

Verify the source line does not appear on generated pages:

$ grep -c "page-source" docs/_build/html/genindex.html

Test plan

  • uv run pytest — all existing tests pass
  • Built docs show Source: docs/index.md · Machine-readable: Raw source in footer on content pages
  • genindex.html and search.html have no source line
  • Raw source link resolves to correct GitHub URL (/raw/main/docs/...)

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-commenter
Copy link
Copy Markdown

codecov-commenter commented May 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.82%. Comparing base (3b18b5d) to head (64c4932).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

why: document the new footer feature for the unreleased changelog

what:
- Add What's new entry for source-path and raw-source link (#46)
@tony tony merged commit 23bd389 into main May 25, 2026
42 checks passed
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.

2 participants