Skip to content
Closed
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
9 changes: 9 additions & 0 deletions readthedocs/doc_builder/templates/doc_builder/conf.py.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,15 @@ if 'html_context' in globals():
else:
html_context = context

# Add custom RTD templates
Copy link
Member Author

Choose a reason for hiding this comment

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

We were talking to move this code into the extra_context block and use it in the corporate site.

if using_rtd_theme:
Copy link
Member Author

Choose a reason for hiding this comment

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

Overriding the templates only when using our own theme, but what would happen with derivated themes?

They will have the content of the versions.html that comes from our sphinx_rtd_theme instead of this one.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is a good question. Maybe through some Sphinx internals we can determine if the theme in use extends our theme at some point? This sounds like a hard and error prone thing to determine though.

Ultimately, this might be a really good reason to keep this logic in our theme. The work required to replicate if READTHEDOCS is going to be substantial. Even if removing READTHEDOCS from our theme is technically correct, leaving it is the right thing to do.

if 'templates_path' in globals():
templates_path.append('{{ template_path }}')
else:
templates_path = [
'{{ template_path }}',
]

# Add custom RTD extension
if 'extensions' in globals():
# Insert at the beginning because it can interfere
Expand Down
12 changes: 12 additions & 0 deletions readthedocs/templates/sphinx/versions.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{# Template override to avoid adding static version menu into Read the Docs production sites #}
{# Add rst-badge after rst-versions for small badge style. #}
<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions">
<span class="rst-current-version" data-toggle="rst-current-version">
<span class="fa fa-book"> Read the Docs</span>
v: {{ current_version }}
<span class="fa fa-caret-down"></span>
</span>
<div class="rst-other-versions">
{# This content is injected by an AJAX call to readthedocs.org/readthedocs.com #}
</div>
</div>