Warning banner should only show on /devel/
docs, not on pages with 'devel' in their titles (#70849)
* banner should not be placed on pages with 'devel' in their titles * Update docs/docsite/_themes/sphinx_rtd_theme/ansible_banner.html Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua> * Only match paths at the beginning Co-authored-by: Alicia Cozine <acozine@users.noreply.github.com> Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua> Co-authored-by: Sviatoslav Sydorenko <webknjaz@redhat.com>
This commit is contained in:
parent
11a31e99e6
commit
8313cc8fb1
1 changed files with 6 additions and 3 deletions
|
@ -1,5 +1,8 @@
|
||||||
<!--- Based on sphinx versionwarning extension. Extension currently only works on READTHEDOCS -->
|
<!--- Based on sphinx versionwarning extension. Extension currently only works on READTHEDOCS -->
|
||||||
<script>
|
<script>
|
||||||
|
startsWith = function(str, needle) {
|
||||||
|
return str.slice(0, needle.length) == needle
|
||||||
|
}
|
||||||
// Create a banner if we're not on the official docs site
|
// Create a banner if we're not on the official docs site
|
||||||
if (location.host == "docs.testing.ansible.com") {
|
if (location.host == "docs.testing.ansible.com") {
|
||||||
document.write('<div id="testing_banner_id" class="admonition important">');
|
document.write('<div id="testing_banner_id" class="admonition important">');
|
||||||
|
@ -12,10 +15,10 @@
|
||||||
}
|
}
|
||||||
{% if (not READTHEDOCS) and (available_versions is defined) %}
|
{% if (not READTHEDOCS) and (available_versions is defined) %}
|
||||||
// Create a banner if we're not the latest version
|
// Create a banner if we're not the latest version
|
||||||
current_url = window.location.href;
|
current_url_path = window.location.pathname;
|
||||||
if ((current_url.search("latest") > -1) || (current_url.search("/{{ latest_version }}/") > -1)) {
|
if (startsWith(current_url_path, "/ansible/latest/") || startsWith(current_url_path, "/ansible/{{ latest_version }}/")) {
|
||||||
// no banner for latest release
|
// no banner for latest release
|
||||||
} else if (current_url.search("devel") > -1) {
|
} else if (startsWith(current_url_path, "/ansible/devel/")) {
|
||||||
document.write('<div id="banner_id" class="admonition caution">');
|
document.write('<div id="banner_id" class="admonition caution">');
|
||||||
para = document.createElement('p');
|
para = document.createElement('p');
|
||||||
banner_text=document.createTextNode("You are reading the *devel* version of the Ansible documentation - this version is not guaranteed stable. Use the version selection to the left if you want the latest stable released version.");
|
banner_text=document.createTextNode("You are reading the *devel* version of the Ansible documentation - this version is not guaranteed stable. Use the version selection to the left if you want the latest stable released version.");
|
||||||
|
|
Loading…
Reference in a new issue