From 55bb64499c8e64b6768fb96e2af642064e1deb49 Mon Sep 17 00:00:00 2001 From: Yuriy Andamasov Date: Wed, 6 May 2026 16:15:13 +0300 Subject: docs: link "View page source" to GitHub instead of raw text (#1888) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: link "View page source" to GitHub instead of raw text Adds html_context with display_github=True so the sphinx_rtd_theme generates an "Edit on GitHub" link. READTHEDOCS_GIT_IDENTIFIER is used to point at the exact branch/PR ref being built; falls back to "circinus" for local builds. 🤖 Generated by [robots](https://vyos.io) * docs: fix GitHub source link on RTD PR preview builds On external (PR preview) builds READTHEDOCS_GIT_IDENTIFIER is set to the PR number, which is not a valid GitHub ref. Use the commit hash instead for external builds; branch name for regular builds. 🤖 Generated by [robots](https://vyos.io) --- docs/conf.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'docs') diff --git a/docs/conf.py b/docs/conf.py index e87def82..3e84a34a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -111,6 +111,21 @@ html_static_path = ['_static'] html_extra_path = ['_html_extra'] +_rtd_version_type = os.environ.get('READTHEDOCS_VERSION_TYPE', '') +_github_version = ( + os.environ.get('READTHEDOCS_GIT_COMMIT_HASH', 'circinus') + if _rtd_version_type == 'external' + else os.environ.get('READTHEDOCS_GIT_IDENTIFIER', 'circinus') +) + +html_context = { + 'display_github': True, + 'github_user': 'vyos', + 'github_repo': 'vyos-documentation', + 'github_version': _github_version, + 'conf_py_path': '/docs/', +} + # Custom sidebar templates, must be a dictionary that maps document names # to template names. # -- cgit v1.2.3