Skip to content

Commit cc83bb6

Browse files
committed
Remove all instances of READTHEDOCS
The removes all the if checks for read the docs. On read the docs builds this content is now injected. However, we want to support non read the docs builds and provide a way to generate the version menu. This diff includes changes from #578 and #983
1 parent c984d08 commit cc83bb6

File tree

4 files changed

+19
-16
lines changed

4 files changed

+19
-16
lines changed

docs/configuring.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,13 @@ Miscellaneous options
172172
:type: string
173173
:default: ``#2980B9``
174174

175+
.. confval:: versions_menu
176+
177+
Whether or not to show the bottom left menu listing the versions and links
178+
to VCS repository.
179+
180+
:type: boolean
181+
:default: True
175182

176183
File-wide metadata
177184
==================

sphinx_rtd_theme/layout.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137

138138
{%- if theme_display_version %}
139139
{%- set nav_version = version %}
140-
{%- if READTHEDOCS and current_version %}
140+
{%- if current_version %}
141141
{%- set nav_version = current_version %}
142142
{%- endif %}
143143
{%- if nav_version %}
@@ -215,8 +215,7 @@
215215
});
216216
</script>
217217

218-
{#- Do not conflict with RTD insertion of analytics script #}
219-
{%- if not READTHEDOCS %}
218+
{%- block analytics %}
220219
{%- if theme_analytics_id %}
221220
<!-- Theme Analytics -->
222221
<script>
@@ -233,7 +232,7 @@
233232
</script>
234233

235234
{%- endif %}
236-
{%- endif %}
235+
{%- endblock %}
237236

238237
{%- block footer %} {% endblock %}
239238

sphinx_rtd_theme/theme.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ prev_next_buttons_location = bottom
1818
style_external_links = False
1919
style_nav_header_background =
2020
vcs_pageview_mode =
21+
versions_menu = True

sphinx_rtd_theme/versions.html

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,30 @@
1-
{% if READTHEDOCS %}
1+
{%- block versions_menu %}
2+
{%- if theme_versions_menu|tobool %}
23
{# Add rst-badge after rst-versions for small badge style. #}
34
<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="{{ _('Versions') }}">
45
<span class="rst-current-version" data-toggle="rst-current-version">
5-
<span class="fa fa-book"> Read the Docs</span>
6+
<span class="fa fa-book"> {{ project }}</span>
67
v: {{ current_version }}
78
<span class="fa fa-caret-down"></span>
89
</span>
910
<div class="rst-other-versions">
11+
{%- block versions %}
1012
<dl>
1113
<dt>{{ _('Versions') }}</dt>
1214
{% for slug, url in versions %}
1315
<dd><a href="{{ url }}">{{ slug }}</a></dd>
1416
{% endfor %}
1517
</dl>
18+
{%- endblock %}
19+
{%- block downloads %}
1620
<dl>
1721
<dt>{{ _('Downloads') }}</dt>
1822
{% for type, url in downloads %}
1923
<dd><a href="{{ url }}">{{ type }}</a></dd>
2024
{% endfor %}
2125
</dl>
22-
<dl>
23-
{# Translators: The phrase "Read the Docs" is not translated #}
24-
<dt>{{ _('On Read the Docs') }}</dt>
25-
<dd>
26-
<a href="//{{ PRODUCTION_DOMAIN }}/projects/{{ slug }}/?fromdocs={{ slug }}">{{ _('Project Home') }}</a>
27-
</dd>
28-
<dd>
29-
<a href="//{{ PRODUCTION_DOMAIN }}/builds/{{ slug }}/?fromdocs={{ slug }}">{{ _('Builds') }}</a>
30-
</dd>
31-
</dl>
26+
{%- endblock %}
3227
</div>
3328
</div>
3429
{% endif %}
30+
{%- endblock %}

0 commit comments

Comments
 (0)