diff options
| author | Yuriy Andamasov <yuriy@vyos.io> | 2026-05-06 16:15:22 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-06 14:15:22 +0100 |
| commit | b26a59dbfe0a1e96a71cfd8e9f4bf68e20eb14ec (patch) | |
| tree | fa83d01aac6370db79198487a8768f3f6c5cc321 /docs/conf.py | |
| parent | dfea790b36ddab4c6661436c8eed3cea7af5bd3a (diff) | |
| download | vyos-documentation-b26a59dbfe0a1e96a71cfd8e9f4bf68e20eb14ec.tar.gz vyos-documentation-b26a59dbfe0a1e96a71cfd8e9f4bf68e20eb14ec.zip | |
docs: link "View page source" to GitHub instead of raw text (#1887)
* 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
"current" 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/conf.py')
| -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 1c1014e0..78bc8ec1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -115,6 +115,21 @@ html_extra_path = ['_html_extra'] html_baseurl = 'https://docs.vyos.io/en/latest/' +_rtd_version_type = os.environ.get('READTHEDOCS_VERSION_TYPE', '') +_github_version = ( + os.environ.get('READTHEDOCS_GIT_COMMIT_HASH', 'current') + if _rtd_version_type == 'external' + else os.environ.get('READTHEDOCS_GIT_IDENTIFIER', 'current') +) + +html_context = { + 'display_github': True, + 'github_user': 'vyos', + 'github_repo': 'vyos-documentation', + 'github_version': _github_version, + 'conf_py_path': '/docs/', +} + # sphinx-sitemap: baseurl already includes /en/latest/, so skip lang+version sitemap_url_scheme = '{link}' |
