From 35b6345bdcdc47126b05617736c67892f27db784 Mon Sep 17 00:00:00 2001 From: Sandra McCann Date: Fri, 28 Jun 2019 16:06:49 -0400 Subject: [PATCH] Add a banner message to warn when not on latest documentation (#58526) * add banner to versions that are not latest * move div into script * fix div * move comment * fix shippable errors --- .../sphinx_rtd_theme/ansible_banner.html | 24 +++++++++++++++++++ .../_themes/sphinx_rtd_theme/layout.html | 2 ++ docs/docsite/rst/conf.py | 12 ++++------ 3 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 docs/docsite/_themes/sphinx_rtd_theme/ansible_banner.html diff --git a/docs/docsite/_themes/sphinx_rtd_theme/ansible_banner.html b/docs/docsite/_themes/sphinx_rtd_theme/ansible_banner.html new file mode 100644 index 00000000000..3410f1e59a7 --- /dev/null +++ b/docs/docsite/_themes/sphinx_rtd_theme/ansible_banner.html @@ -0,0 +1,24 @@ + +{# Creates a banner at the top of the page for any version not latest. #} + diff --git a/docs/docsite/_themes/sphinx_rtd_theme/layout.html b/docs/docsite/_themes/sphinx_rtd_theme/layout.html index 4b4d7ebd0fe..6ec110b64b0 100644 --- a/docs/docsite/_themes/sphinx_rtd_theme/layout.html +++ b/docs/docsite/_themes/sphinx_rtd_theme/layout.html @@ -232,6 +232,8 @@ --> {% include "breadcrumbs.html" %} + + {% include "ansible_banner.html" %}
{% block body %}{% endblock %}
diff --git a/docs/docsite/rst/conf.py b/docs/docsite/rst/conf.py index f152f393cd5..62f565eae44 100644 --- a/docs/docsite/rst/conf.py +++ b/docs/docsite/rst/conf.py @@ -144,7 +144,11 @@ html_context = { 'github_user': 'ansible', 'github_repo': 'ansible', 'github_version': 'devel/docs/docsite/rst/', - 'github_module_version': 'devel/lib/ansible/modules/' + 'github_module_version': 'devel/lib/ansible/modules/', + 'current_version': version, + 'latest_version': '2.8', + # list specifically out of order to make latest work + 'available_versions': ('latest', '2.7', '2.6', 'devel') } # The style sheet to use for HTML and HTML Help pages. A file of that name @@ -263,9 +267,3 @@ autoclass_content = 'both' intersphinx_mapping = {'python': ('https://docs.python.org/2/', (None, '../python2-2.7.13.inv')), 'python3': ('https://docs.python.org/3/', (None, '../python3-3.6.2.inv')), 'jinja2': ('http://jinja.pocoo.org/docs/', (None, '../jinja2-2.9.7.inv'))} - -# list specifically out of order to make latest work -html_context = { - 'current_version': version, - 'available_versions': ('latest', '2.7', '2.6', 'devel') -}