From 8fdd1ad529bf00b2edfc51410d34ec8bf934c833 Mon Sep 17 00:00:00 2001
From: squidfunk <martin.donath@squidfunk.com>
Date: Sat, 12 Nov 2022 14:44:59 +0100
Subject: [PATCH] Added support for disabling footer navigation

---
 material/base.html             |   4 +-
 material/partials/consent.html |   2 +-
 material/partials/content.html |   2 +-
 material/partials/footer.html  |  76 +++++++++++-----------
 mkdocs.yml                     |   1 +
 src/base.html                  |   4 +-
 src/partials/consent.html      |   2 +-
 src/partials/content.html      |   2 +-
 src/partials/footer.html       | 112 +++++++++++++++++----------------
 9 files changed, 105 insertions(+), 100 deletions(-)

diff --git a/material/base.html b/material/base.html
index 9acd774d5..8cc225e18 100644
--- a/material/base.html
+++ b/material/base.html
@@ -138,7 +138,7 @@
     <div class="md-container" data-md-component="container">
       {% block hero %}{% endblock %}
       {% block tabs %}
-        {% if not "navigation.tabs.sticky" in features %}
+        {% if "navigation.tabs.sticky" not in features %}
           {% if "navigation.tabs" in features %}
             {% include "partials/tabs.html" %}
           {% endif %}
@@ -159,7 +159,7 @@
                 </div>
               </div>
             {% endif %}
-            {% if not "toc.integrate" in features %}
+            {% if "toc.integrate" not in features %}
               {% if page.meta and page.meta.hide %}
                 {% set hidden = "hidden" if "toc" in page.meta.hide %}
               {% endif %}
diff --git a/material/partials/consent.html b/material/partials/consent.html
index b97803b7d..dea39bc30 100644
--- a/material/partials/consent.html
+++ b/material/partials/consent.html
@@ -16,7 +16,7 @@
 {% if not actions %}
   {% set actions = ["accept", "manage"] %}
 {% endif %}
-{% if not "manage" in actions %}
+{% if "manage" not in actions %}
   {% set checked = "checked" %}
 {% endif %}
 <h4>{{ config.extra.consent.title }}</h4>
diff --git a/material/partials/content.html b/material/partials/content.html
index e61bcfb17..ff9eedfa0 100644
--- a/material/partials/content.html
+++ b/material/partials/content.html
@@ -5,7 +5,7 @@
   {% include "partials/tags.html" %}
 {% endif %}
 {% include "partials/actions.html" %}
-{% if not "\x3ch1" in page.content %}
+{% if "\x3ch1" not in page.content %}
   <h1>{{ page.title | d(config.site_name, true)}}</h1>
 {% endif %}
 {{ page.content }}
diff --git a/material/partials/footer.html b/material/partials/footer.html
index 36f96e5c1..9e1b23696 100644
--- a/material/partials/footer.html
+++ b/material/partials/footer.html
@@ -2,44 +2,46 @@
   This file was automatically generated - do not edit
 -#}
 <footer class="md-footer">
-  {% if page.previous_page or page.next_page %}
-    {% if page.meta and page.meta.hide %}
-      {% set hidden = "hidden" if "footer" in page.meta.hide %}
+  {% if "navigation.footer" in features %}
+    {% if page.previous_page or page.next_page %}
+      {% if page.meta and page.meta.hide %}
+        {% set hidden = "hidden" if "footer" in page.meta.hide %}
+      {% endif %}
+      <nav class="md-footer__inner md-grid" aria-label="{{ lang.t('footer') }}" {{ hidden }}>
+        {% if page.previous_page %}
+          {% set direction = lang.t("footer.previous") %}
+          <a href="{{ page.previous_page.url | url }}" class="md-footer__link md-footer__link--prev" aria-label="{{ direction }}: {{ page.previous_page.title | e }}" rel="prev">
+            <div class="md-footer__button md-icon">
+              {% include ".icons/material/arrow-left.svg" %}
+            </div>
+            <div class="md-footer__title">
+              <div class="md-ellipsis">
+                <span class="md-footer__direction">
+                  {{ direction }}
+                </span>
+                {{ page.previous_page.title }}
+              </div>
+            </div>
+          </a>
+        {% endif %}
+        {% if page.next_page %}
+          {% set direction = lang.t("footer.next") %}
+          <a href="{{ page.next_page.url | url }}" class="md-footer__link md-footer__link--next" aria-label="{{ direction }}: {{ page.next_page.title | e }}" rel="next">
+            <div class="md-footer__title">
+              <div class="md-ellipsis">
+                <span class="md-footer__direction">
+                  {{ direction }}
+                </span>
+                {{ page.next_page.title }}
+              </div>
+            </div>
+            <div class="md-footer__button md-icon">
+              {% include ".icons/material/arrow-right.svg" %}
+            </div>
+          </a>
+        {% endif %}
+      </nav>
     {% endif %}
-    <nav class="md-footer__inner md-grid" aria-label="{{ lang.t('footer') }}" {{ hidden }}>
-      {% if page.previous_page %}
-        {% set direction = lang.t("footer.previous") %}
-        <a href="{{ page.previous_page.url | url }}" class="md-footer__link md-footer__link--prev" aria-label="{{ direction }}: {{ page.previous_page.title | e }}" rel="prev">
-          <div class="md-footer__button md-icon">
-            {% include ".icons/material/arrow-left.svg" %}
-          </div>
-          <div class="md-footer__title">
-            <div class="md-ellipsis">
-              <span class="md-footer__direction">
-                {{ direction }}
-              </span>
-              {{ page.previous_page.title }}
-            </div>
-          </div>
-        </a>
-      {% endif %}
-      {% if page.next_page %}
-        {% set direction = lang.t("footer.next") %}
-        <a href="{{ page.next_page.url | url }}" class="md-footer__link md-footer__link--next" aria-label="{{ direction }}: {{ page.next_page.title | e }}" rel="next">
-          <div class="md-footer__title">
-            <div class="md-ellipsis">
-              <span class="md-footer__direction">
-                {{ direction }}
-              </span>
-              {{ page.next_page.title }}
-            </div>
-          </div>
-          <div class="md-footer__button md-icon">
-            {% include ".icons/material/arrow-right.svg" %}
-          </div>
-        </a>
-      {% endif %}
-    </nav>
   {% endif %}
   <div class="md-footer-meta md-typeset">
     <div class="md-footer-meta__inner md-grid">
diff --git a/mkdocs.yml b/mkdocs.yml
index 40125a857..ae2ef5017 100755
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -45,6 +45,7 @@ theme:
     - content.tooltips
     # - header.autohide
     # - navigation.expand
+    - navigation.footer
     - navigation.indexes
     # - navigation.instant
     # - navigation.prune
diff --git a/src/base.html b/src/base.html
index 72948f531..ea5b57f5e 100644
--- a/src/base.html
+++ b/src/base.html
@@ -263,7 +263,7 @@
 
       <!-- Navigation tabs (collapsing) -->
       {% block tabs %}
-        {% if not "navigation.tabs.sticky" in features %}
+        {% if "navigation.tabs.sticky" not in features %}
           {% if "navigation.tabs" in features %}
             {% include "partials/tabs.html" %}
           {% endif %}
@@ -297,7 +297,7 @@
             {% endif %}
 
             <!-- Table of contents -->
-            {% if not "toc.integrate" in features %}
+            {% if "toc.integrate" not in features %}
               {% if page.meta and page.meta.hide %}
                 {% set hidden = "hidden" if "toc" in page.meta.hide %}
               {% endif %}
diff --git a/src/partials/consent.html b/src/partials/consent.html
index 168b4c13c..564380ccb 100644
--- a/src/partials/consent.html
+++ b/src/partials/consent.html
@@ -40,7 +40,7 @@
 {% endif %}
 
 <!-- Determine initial settings state -->
-{% if not "manage" in actions %}
+{% if "manage" not in actions %}
   {% set checked = "checked" %}
 {% endif %}
 
diff --git a/src/partials/content.html b/src/partials/content.html
index 9cb8f3d44..075f1a90a 100644
--- a/src/partials/content.html
+++ b/src/partials/content.html
@@ -32,7 +32,7 @@
   Hack: check whether the content contains a h1 headline. If it doesn't, the
   page title (or respectively site name) is used as the main headline.
 -->
-{% if not "\x3ch1" in page.content %}
+{% if "\x3ch1" not in page.content %}
   <h1>{{ page.title | d(config.site_name, true)}}</h1>
 {% endif %}
 
diff --git a/src/partials/footer.html b/src/partials/footer.html
index 8d1b01cc4..24b10be33 100644
--- a/src/partials/footer.html
+++ b/src/partials/footer.html
@@ -24,62 +24,64 @@
 <footer class="md-footer">
 
   <!-- Link to previous and/or next page -->
-  {% if page.previous_page or page.next_page %}
-    {% if page.meta and page.meta.hide %}
-      {% set hidden = "hidden" if "footer" in page.meta.hide %}
+  {% if "navigation.footer" in features %}
+    {% if page.previous_page or page.next_page %}
+      {% if page.meta and page.meta.hide %}
+        {% set hidden = "hidden" if "footer" in page.meta.hide %}
+      {% endif %}
+      <nav
+        class="md-footer__inner md-grid"
+        aria-label="{{ lang.t('footer') }}"
+        {{ hidden }}
+      >
+
+        <!-- Link to previous page -->
+        {% if page.previous_page %}
+          {% set direction = lang.t("footer.previous") %}
+          <a
+            href="{{ page.previous_page.url | url }}"
+            class="md-footer__link md-footer__link--prev"
+            aria-label="{{ direction }}: {{ page.previous_page.title | e }}"
+            rel="prev"
+          >
+            <div class="md-footer__button md-icon">
+              {% include ".icons/material/arrow-left.svg" %}
+            </div>
+            <div class="md-footer__title">
+              <div class="md-ellipsis">
+                <span class="md-footer__direction">
+                  {{ direction }}
+                </span>
+                {{ page.previous_page.title }}
+              </div>
+            </div>
+          </a>
+        {% endif %}
+
+        <!-- Link to next page -->
+        {% if page.next_page %}
+          {% set direction = lang.t("footer.next") %}
+          <a
+            href="{{ page.next_page.url | url }}"
+            class="md-footer__link md-footer__link--next"
+            aria-label="{{ direction }}: {{ page.next_page.title | e }}"
+            rel="next"
+          >
+            <div class="md-footer__title">
+              <div class="md-ellipsis">
+                <span class="md-footer__direction">
+                  {{ direction }}
+                </span>
+                {{ page.next_page.title }}
+              </div>
+            </div>
+            <div class="md-footer__button md-icon">
+              {% include ".icons/material/arrow-right.svg" %}
+            </div>
+          </a>
+        {% endif %}
+      </nav>
     {% endif %}
-    <nav
-      class="md-footer__inner md-grid"
-      aria-label="{{ lang.t('footer') }}"
-      {{ hidden }}
-    >
-
-      <!-- Link to previous page -->
-      {% if page.previous_page %}
-        {% set direction = lang.t("footer.previous") %}
-        <a
-          href="{{ page.previous_page.url | url }}"
-          class="md-footer__link md-footer__link--prev"
-          aria-label="{{ direction }}: {{ page.previous_page.title | e }}"
-          rel="prev"
-        >
-          <div class="md-footer__button md-icon">
-            {% include ".icons/material/arrow-left.svg" %}
-          </div>
-          <div class="md-footer__title">
-            <div class="md-ellipsis">
-              <span class="md-footer__direction">
-                {{ direction }}
-              </span>
-              {{ page.previous_page.title }}
-            </div>
-          </div>
-        </a>
-      {% endif %}
-
-      <!-- Link to next page -->
-      {% if page.next_page %}
-        {% set direction = lang.t("footer.next") %}
-        <a
-          href="{{ page.next_page.url | url }}"
-          class="md-footer__link md-footer__link--next"
-          aria-label="{{ direction }}: {{ page.next_page.title | e }}"
-          rel="next"
-        >
-          <div class="md-footer__title">
-            <div class="md-ellipsis">
-              <span class="md-footer__direction">
-                {{ direction }}
-              </span>
-              {{ page.next_page.title }}
-            </div>
-          </div>
-          <div class="md-footer__button md-icon">
-            {% include ".icons/material/arrow-right.svg" %}
-          </div>
-        </a>
-      {% endif %}
-    </nav>
   {% endif %}
 
   <!-- Further information -->