-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Override versions.html template for specific RTD functionality #4234
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -132,6 +132,15 @@ if 'html_context' in globals(): | |
| else: | ||
| html_context = context | ||
|
|
||
| # Add custom RTD templates | ||
| if using_rtd_theme: | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 '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 | ||
|
|
||
| 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> |
There was a problem hiding this comment.
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_contextblock and use it in the corporate site.