summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorYuriy Andamasov <yuriy@vyos.io>2026-05-06 16:15:13 +0300
committerGitHub <noreply@github.com>2026-05-06 14:15:13 +0100
commit55bb64499c8e64b6768fb96e2af642064e1deb49 (patch)
treee1adaee3344206215d5c1b1850f3f54238fb09fc /docs
parent9d0341379184622b3da2e7e05aeeceed4bbf83e9 (diff)
downloadvyos-documentation-55bb64499c8e64b6768fb96e2af642064e1deb49.tar.gz
vyos-documentation-55bb64499c8e64b6768fb96e2af642064e1deb49.zip
docs: link "View page source" to GitHub instead of raw text (#1888)
* 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)
Diffstat (limited to 'docs')
-rw-r--r--docs/conf.py15
1 files changed, 15 insertions, 0 deletions
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.
#