Skip to content

Commit 103d5d8

Browse files
committed
Allow users to show custom version values (#1624)
Add support for custom version strings in selfhosted builds. This revives the 'display_version' config option, setting it to default value of False. If the language or version selection is enabled it will be prioritized over 'display_version'. Signed-off-by: Randolph Sapp <[email protected]>
1 parent 5a26375 commit 103d5d8

File tree

5 files changed

+16
-2
lines changed

5 files changed

+16
-2
lines changed

docs/configuring.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ For example:
1616
'analytics_id': 'G-XXXXXXXXXX', # Provided by Google in your dashboard
1717
'analytics_anonymize_ip': False,
1818
'logo_only': False,
19+
'display_version': True,
1920
'prev_next_buttons_location': 'bottom',
2021
'style_external_links': False,
2122
'vcs_pageview_mode': '',
2223
'style_nav_header_background': 'white',
2324
'flyout_display': 'hidden',
24-
'version_selector': True,
25+
'version_selector': True, # Will be prioritized over display_version
2526
'language_selector': True,
2627
# Toc options
2728
'collapse_navigation': True,

sphinx_rtd_theme/layout.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,13 @@
131131
<div class="language-switch"></div>
132132
</div>
133133
{%- endif %}
134+
{%- elif theme_display_version %}
135+
{%- set nav_version = version %}
136+
{%- if nav_version %}
137+
<div class="version">
138+
{{ nav_version }}
139+
</div>
140+
{%- endif %}
134141
{%- endif %}
135142

136143
{%- include "searchbox.html" %}

sphinx_rtd_theme/static/css/theme.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sphinx_rtd_theme/theme.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ navigation_depth = 4
1313
includehidden = True
1414
titles_only =
1515
logo_only =
16+
display_version = True
1617
prev_next_buttons_location = bottom
1718
style_external_links = False
1819
style_nav_header_background =

src/sass/_theme_layout.sass

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,11 @@ html
231231
display: block
232232
img.logo
233233
margin-top: 0.85em // space it away from the title text
234+
> div.version
235+
margin-top: -1 * $gutter / 4
236+
margin-bottom: $gutter / 2
237+
font-weight: normal
238+
color: rgba(255, 255, 255, 0.3)
234239
> div.switch-menus
235240
position: relative
236241
display: block

0 commit comments

Comments
 (0)