summaryrefslogtreecommitdiffstats
path: root/docs/docsite/.templates
diff options
context:
space:
mode:
Diffstat (limited to 'docs/docsite/.templates')
-rw-r--r--docs/docsite/.templates/banner.html77
-rw-r--r--docs/docsite/.templates/breadcrumbs.html52
-rw-r--r--docs/docsite/.templates/version_chooser.html4
3 files changed, 133 insertions, 0 deletions
diff --git a/docs/docsite/.templates/banner.html b/docs/docsite/.templates/banner.html
new file mode 100644
index 0000000..698870f
--- /dev/null
+++ b/docs/docsite/.templates/banner.html
@@ -0,0 +1,77 @@
+{% if is_eol %}
+{# Creates a banner at the top of the page for EOL versions. #}
+<div id='banner' class='Admonition caution'>
+ <p>You are reading an unmaintained version of the Ansible documentation. Unmaintained Ansible versions can contain unfixed security vulnerabilities (CVE). Please upgrade to a maintained version. See <a href="/ansible/latest/">the latest Ansible documentation</a>.</p>
+</div>
+{% else %}
+ <script>
+ function startsWith(str, needle) {
+ return str.slice(0, needle.length) == needle
+ }
+ function startsWithOneOf(str, needles) {
+ return needles.some(function (needle) {
+ return startsWith(str, needle);
+ });
+ }
+ var banner = '';
+ var extra_banner = '';
+ /*use extra_banner for when marketing wants something extra, like a survey or AnsibleFest notice */
+ var extra_banner =
+ '<div id="latest_extra_banner_id" class="admonition important">' +
+ '<br>' +
+ '<p>' +
+ '<b>Experience AnsibleFest at Red Hat Summit</b>' +
+ '</p>' +
+ '<p>' +
+ 'We\'re bringing AnsibleFest to Red Hat Summit in Boston, May 23-25. It\'s the best of Fest combined with Red Hat Summit for even more learning and technical engagement. <a href="https://www.redhat.com/en/summit/ansiblefest?intcmp=7013a0000034lvhAAA">Learn more.</a> ' +
+
+ '</p>' +
+ '<br>' +
+ '</div>';
+ // 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">' +
+ '<p>This is the testing site for Ansible Documentation. Unless you are reviewing pre-production changes, please visit the <a href="https://docs.ansible.com/ansible/latest/">official documentation website</a>.</p> <p></p>' +
+ '</div>');
+ }
+ {% if available_versions is defined %}
+ // Create a banner
+ current_url_path = window.location.pathname;
+
+ var important = false;
+ var msg = '<p>';
+ if (startsWith(current_url_path, "/ansible-core/")) {
+ msg += 'You are reading documentation for Ansible Core, which contains no plugins except for those in ansible.builtin. For documentation of the Ansible package, go to <a href="/ansible/latest">the latest documentation</a>.';
+ } else if (startsWithOneOf(current_url_path, ["/ansible/latest/", "/ansible/{{ latest_version }}/"])) {
+ /* temp extra banner to advertise AnsibeFest2021 */
+ banner += extra_banner;
+
+ msg += 'You are reading the <b>latest</b> (stable) community version of the Ansible documentation. If you are a Red Hat customer, refer to the <a href="https://access.redhat.com/support/policy/updates/ansible-automation-platform">Ansible Automation Platform Life Cycle</a> page for subscription details.';
+ } else if (startsWith(current_url_path, "/ansible/2.9/")) {
+ msg += 'You are reading the latest Red Hat released version of the Ansible documentation. Community users can use this version, or select <b>latest</b> from the version selector to the left for the most recent community version.';
+ } else if (startsWith(current_url_path, "/ansible/devel/")) {
+ /* temp extra banner to advertise AnsibleFest2021 */
+ banner += extra_banner;
+
+ /* temp banner to advertise survey
+ important = true;
+ msg += 'Please take our <a href="https://www.surveymonkey.co.uk/r/B9V3CDY">Docs survey</a> before December 31 to help us improve Ansible documentation.';
+ */
+
+ msg += 'You are reading the <b>devel</b> version of the Ansible documentation - this version is not guaranteed stable. Use the version selection to the left if you want the <b>latest</b> (stable) released version.';
+ } else {
+ msg += 'You are reading an older version of the Ansible documentation. Use the version selection to the left if you want the <b>latest</b> (stable) released version.';
+ }
+ msg += '</p>';
+
+ banner += '<div id="banner_id" class="admonition ';
+ banner += important ? 'important' : 'caution';
+ banner += '">';
+ banner += important ? '<br>' : '';
+ banner += msg;
+ banner += important ? '<br>' : '';
+ banner += '</div>';
+ document.write(banner);
+ {% endif %}
+ </script>
+{% endif %}
diff --git a/docs/docsite/.templates/breadcrumbs.html b/docs/docsite/.templates/breadcrumbs.html
new file mode 100644
index 0000000..de006f6
--- /dev/null
+++ b/docs/docsite/.templates/breadcrumbs.html
@@ -0,0 +1,52 @@
+{%- extends "!breadcrumbs.html" %}
+{%- block breadcrumbs_aside %}
+ <li class="wy-breadcrumbs-aside">
+ {%- if hasdoc(pagename) and display_vcs_links %}
+ {%- if display_github %}
+ {%- if check_meta and 'github_url' in meta %}
+ <!-- User defined GitHub URL -->
+ <a href="{{ meta['github_url'] }}" class="fa fa-github"> {{ _('Edit on GitHub') }}</a>
+ {%- else %}
+ <!-- Ansible-specific additions for modules etc -->
+ {% if check_meta and pagename.endswith((
+ '_module', '_become', '_cache', '_callback',
+ '_connection', '_inventory', '_lookup',
+ '_shell', '_strategy', '_vars',
+ )) %}
+ {# <a href="https://{{ github_host|default("github.com") }}/{{ github_user }}/{{ github_repo }}/{{ theme_vcs_pageview_mode or "blob" }}/{{ github_module_version }}{{ meta.get('source', '') }}?description=%23%23%23%23%23%20SUMMARY%0A%3C!---%20Your%20description%20here%20--%3E%0A%0A%0A%23%23%23%23%23%20ISSUE%20TYPE%0A-%20Docs%20Pull%20Request%0A%0A%2Blabel:%20docsite_pr" class="fa fa-github"> {{ _('Edit on GitHub') }}</a> #}
+ <br>
+ <!-- Remove main index page as it is no longer editable -->
+ {% elif pagename == 'index' %}
+ <br>
+ <!-- Remove all pages under collections/ as no longer editable -->
+ {% elif pagename.startswith('collections/') %}
+ <br>
+
+ {% elif check_meta and pagename.startswith('cli') and meta.get('source', None) %}
+ <a href="https://{{ github_host|default("github.com") }}/{{ github_user }}/{{ github_repo }}/{{ theme_vcs_pageview_mode or "blob" }}/{{ github_cli_version }}{{ meta.get('source', '') }}?description=%23%23%23%23%23%20SUMMARY%0A%3C!---%20Your%20description%20here%20--%3E%0A%0A%0A%23%23%23%23%23%20ISSUE%20TYPE%0A-%20Docs%20Pull%20Request%0A%0A%2Blabel:%20docsite_pr" class="fa fa-github"> {{ _('Edit on GitHub') }}</a>
+ {% elif (not 'list_of' in pagename) and (not 'category' in pagename) %}
+ <a href="https://{{ github_host|default("github.com") }}/{{ github_user }}/{{ github_repo }}/{{ theme_vcs_pageview_mode or "blob" }}/{{ github_version }}{{ conf_py_path }}{{ pagename }}{{ page_source_suffix }}?description=%23%23%23%23%23%20SUMMARY%0A%3C!---%20Your%20description%20here%20--%3E%0A%0A%0A%23%23%23%23%23%20ISSUE%20TYPE%0A-%20Docs%20Pull%20Request%0A%0A%2Blabel:%20docsite_pr" class="fa fa-github"> {{ _('Edit on GitHub') }}</a>
+ {% endif %}
+ {%- endif %}
+ {%- elif display_bitbucket %}
+ {%- if check_meta and 'bitbucket_url' in meta %}
+ <!-- User defined Bitbucket URL -->
+ <a href="{{ meta['bitbucket_url'] }}" class="fa fa-bitbucket"> {{ _('Edit on Bitbucket') }}</a>
+ {%- else %}
+ <a href="https://bitbucket.org/{{ bitbucket_user }}/{{ bitbucket_repo }}/src/{{ bitbucket_version}}{{ conf_py_path }}{{ pagename }}{{ page_source_suffix }}?mode={{ theme_vcs_pageview_mode or "view" }}" class="fa fa-bitbucket"> {{ _('Edit on Bitbucket') }}</a>
+ {%- endif %}
+ {%- elif display_gitlab %}
+ {%- if check_meta and 'gitlab_url' in meta %}
+ <!-- User defined GitLab URL -->
+ <a href="{{ meta['gitlab_url'] }}" class="fa fa-gitlab"> {{ _('Edit on GitLab') }}</a>
+ {%- else %}
+ <a href="https://{{ gitlab_host|default("gitlab.com") }}/{{ gitlab_user }}/{{ gitlab_repo }}/{{ theme_vcs_pageview_mode or "blob" }}/{{ gitlab_version }}{{ conf_py_path }}{{ pagename }}{{ page_source_suffix }}" class="fa fa-gitlab"> {{ _('Edit on GitLab') }}</a>
+ {%- endif %}
+ {%- elif show_source and source_url_prefix %}
+ <a href="{{ source_url_prefix }}{{ pagename }}{{ page_source_suffix }}">{{ _('View page source') }}</a>
+ {%- elif show_source and has_source and sourcename %}
+ <a href="{{ pathto('_sources/' + sourcename, true)|e }}" rel="nofollow"> {{ _('View page source') }}</a>
+ {%- endif %}
+ {%- endif %}
+ </li>
+{%- endblock %}
diff --git a/docs/docsite/.templates/version_chooser.html b/docs/docsite/.templates/version_chooser.html
new file mode 100644
index 0000000..c32a6ba
--- /dev/null
+++ b/docs/docsite/.templates/version_chooser.html
@@ -0,0 +1,4 @@
+{# https://jinja.palletsprojects.com/en/3.0.x/tricks/#null-default-fallback #}
+{%- if not is_eol %}
+ {%- extends "!version_chooser.html" %}
+{%- endif %}