Do not display "latest" badge if repo is not versioned

We do now display the badge for version even on repos that do not have
branches like https://docs.openstack.org/infra/manual . The reason is
that the test is against series - and we *always* set series, by default
to 'latest'.

Add a new option to disable showing of the badge called display_badge
and use it. Repos can set this as part of html options.

Disable showing the badge for api-ref test document.

Change-Id: I985b49412aa1848b915b8f0a2ff9e95867e420ca
This commit is contained in:
Andreas Jaeger 2018-08-18 09:37:55 +02:00
parent 7bd1de09c0
commit 8715f67645
5 changed files with 18 additions and 5 deletions

View File

@ -49,7 +49,7 @@ master_doc = 'index'
# It's used by the "log-a-bug" button on each page
# and should ultimately be set automatically by the build process
project = u'Test API Reference'
copyright = u'2016, OpenStack Contributors'
copyright = u'2018, OpenStack Contributors'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
@ -121,6 +121,7 @@ html_theme = 'openstackdocs'
# Otherwise, the list of links for the User and Ops docs
# appear in the sidebar dropdown menu.
html_theme_options = {"sidebar_dropdown": "api_ref",
"display_badge": False,
"sidebar_mode": "toc"}
# Add any paths that contain custom themes here, relative to this directory.

View File

@ -21,7 +21,7 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
copyright = u'2015-2017, OpenStack Contributors'
copyright = u'2015-2018, OpenStack Contributors'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
@ -46,7 +46,9 @@ html_theme = 'openstackdocs'
# variable, sidebar_dropdown, should be set to `api_ref`.
# Otherwise, the list of links for the User and Ops docs
# appear in the sidebar dropdown menu.
html_theme_options = {'show_other_versions': True}
html_theme_options = {
'show_other_versions': True
}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,

View File

@ -140,6 +140,15 @@ with documentation available. By default it is set to ``None``::
document with internal versioning.
By default, a badge is displayed showing which the latest OpenStack
release is. You can disable the badge with::
html_theme_options = {
# ...
"display_badge": False,
# ...
}
External Link Helper
--------------------

View File

@ -94,7 +94,7 @@ ga('send', 'pageview');
{% include 'footer.html' %}
{% include 'script_footer.html' %}
{% block script_footer %}{% endblock %}
{% if series %}
{% if theme_display_badge %}
<script type="text/javascript">
$(document).ready(function(){

View File

@ -6,6 +6,7 @@ pygments_style = native
[options]
analytics_tracking_code = UA-17511903-1
sidebar_mode = toctree
display_badge = True
display_toc = True
sidebar_dropdown = os_docs
show_other_versions = False