diff options
| author | Yuriy Andamasov <yuriy@vyos.io> | 2026-05-06 16:15:05 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-06 14:15:05 +0100 |
| commit | c784d8880325f96423fdd2c558750cac4313a56e (patch) | |
| tree | 100d0a1f5f8c2ff8700d8824d859072f11dc9ee7 /docs | |
| parent | e066bb43eab070c58043f69efe87191b354b01e5 (diff) | |
| download | vyos-documentation-c784d8880325f96423fdd2c558750cac4313a56e.tar.gz vyos-documentation-c784d8880325f96423fdd2c558750cac4313a56e.zip | |
docs: link "View page source" to GitHub instead of raw text (#1889)
* 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
"sagitta" 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.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/docs/conf.py b/docs/conf.py index 7d933306..02135cc1 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', 'sagitta') + if _rtd_version_type == 'external' + else os.environ.get('READTHEDOCS_GIT_IDENTIFIER', 'sagitta') +) + +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. # |
