summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAlicia Cozine <879121+acozine@users.noreply.github.com>2020-08-06 18:48:36 -0500
committerGitHub <noreply@github.com>2020-08-06 18:48:36 -0500
commitbc378ae6431b580caa38bb9cd902a05c2bde154d (patch)
tree29ef47e22f3dcb4078cf859992904a8cfab0610a /docs
parentfba387fd64b8096cf539d421dda1ce75be5fd3eb (diff)
downloadansible-bc378ae6431b580caa38bb9cd902a05c2bde154d.tar.gz
Warning banner should only show on `/devel/` docs, not on pages with 'devel' in their titles (#70849) (#71076)
* banner should not be placed on pages with 'devel' in their titles * Update docs/docsite/_themes/sphinx_rtd_theme/ansible_banner.html * Only match paths at the beginning Co-authored-by: Alicia Cozine <acozine@users.noreply.github.com> Co-authored-by: Sviatoslav Sydorenko <webknjaz@redhat.com> (cherry picked from commit 8313cc8fb1a6f879328b5178f790086a2ba580b2)
Diffstat (limited to 'docs')
-rw-r--r--docs/docsite/_themes/sphinx_rtd_theme/ansible_banner.html48
1 files changed, 26 insertions, 22 deletions
diff --git a/docs/docsite/_themes/sphinx_rtd_theme/ansible_banner.html b/docs/docsite/_themes/sphinx_rtd_theme/ansible_banner.html
index 7ca2bd4a0f..0f1c9a6bb6 100644
--- a/docs/docsite/_themes/sphinx_rtd_theme/ansible_banner.html
+++ b/docs/docsite/_themes/sphinx_rtd_theme/ansible_banner.html
@@ -1,5 +1,8 @@
<!--- Based on sphinx versionwarning extension. Extension currently only works on READTHEDOCS -->
<script>
+ startsWith = function(str, needle) {
+ return str.slice(0, needle.length) == needle
+ }
// Create a banner if we're not on the official docs site
if (location.host == "docs.testing.ansible.com") {
document.write('<div id="testing_banner_id" class="admonition important">');
@@ -10,26 +13,27 @@
element.appendChild(para);
document.write('</div>');
}
-
- // Create a banner if we're not the latest version
- current_url = window.location.href;
- if ((current_url.search("latest") > -1) || (current_url.search("/{{ latest_version }}/") > -1)) {
- // no banner for latest release
- } else if (current_url.search("devel") > -1) {
- document.write('<div id="banner_id" class="admonition caution">');
- para = document.createElement('p');
- banner_text=document.createTextNode("You are reading the *devel* version of the Ansible documentation - most module documentation is currently missing as the modules have moved to collections. Until docs catches up to this change, use the version selection to the left if you want module documentation or the latest stable release version. The *devel* version is not guaranteed stable.");
- para.appendChild(banner_text);
- element = document.getElementById('banner_id');
- element.appendChild(para);
- document.write('</div>');
- } else {
- document.write('<div id="banner_id" class="admonition caution">');
- para = document.createElement('p');
- banner_text=document.createTextNode("You are reading an older version of the Ansible documentation. Use the version selection to the left if you want the latest stable released version.");
- para.appendChild(banner_text);
- element = document.getElementById('banner_id');
- element.appendChild(para);
- document.write('</div>');
- }
+ {% if (not READTHEDOCS) and (available_versions is defined) %}
+ // Create a banner if we're not the latest version
+ current_url_path = window.location.pathname;
+ if (startsWith(current_url_path, "/ansible/latest/") || startsWith(current_url_path, "/ansible/{{ latest_version }}/")) {
+ // no banner for latest release
+ } else if (startsWith(current_url_path, "/ansible/devel/")) {
+ document.write('<div id="banner_id" class="admonition caution">');
+ 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.");
+ para.appendChild(banner_text);
+ element = document.getElementById('banner_id');
+ element.appendChild(para);
+ document.write('</div>');
+ } else {
+ document.write('<div id="banner_id" class="admonition caution">');
+ para = document.createElement('p');
+ banner_text=document.createTextNode("You are reading an older version of the Ansible documentation. Use the version selection to the left if you want the latest stable released version.");
+ para.appendChild(banner_text);
+ element = document.getElementById('banner_id');
+ element.appendChild(para);
+ document.write('</div>');
+ }
+ {% endif %}
</script>