Skip to content

Fix conf.py for external versions #7845

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions readthedocs/doc_builder/backends/sphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ def get_config_params(self):
protocol = 'http' if settings.DEBUG else 'https'
build_url = f'{protocol}://{settings.PRODUCTION_DOMAIN}{build_url}'

vcs_url = None
if self.version.is_external:
vcs_url = self.version.vcs_url

data = {
'html_theme': 'sphinx_rtd_theme',
'html_theme_import': 'sphinx_rtd_theme',
Expand All @@ -170,6 +174,7 @@ def get_config_params(self):
'downloads': downloads,
'subproject_urls': subproject_urls,
'build_url': build_url,
'vcs_url': vcs_url,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we pass always self.version.vcs_url instead only when it's external? I think that will simplify code reading and thinking about why.

Otherwise, we could have a comment in the previous if.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is only used in external versions currently


# GitHub
'github_user': github_user,
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/doc_builder/templates/doc_builder/conf.py.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ else:
# Add External version warning banner to the external version documentation
if '{{ version.type }}' == 'external':
extensions.insert(1, "readthedocs_ext.external_version_warning")
readthedocs_vcs_url = '{{ version.vcs_url }}'
readthedocs_vcs_url = '{{ vcs_url }}'
readthedocs_build_url = '{{ build_url }}'

project_language = '{{ project.language }}'
Expand Down