From 6db782a64c35b702a7a36502ac951c0930017675 Mon Sep 17 00:00:00 2001 From: squidfunk Date: Sat, 13 Nov 2021 13:08:22 +0100 Subject: [PATCH] Improved extensibility by restructuring template blocks --- material/base.html | 21 ++------- material/partials/footer.html | 4 +- .../partials/{ => javascripts}/outdated.html | 0 material/partials/page-footer.html | 12 ++++++ material/partials/page-header.html | 8 ++++ material/partials/page.html | 7 +++ material/partials/social.html | 26 ++++++----- material/partials/source-file.html | 2 +- src/base.html | 43 ++----------------- src/partials/footer.html | 4 +- src/partials/{ => javascripts}/outdated.html | 0 src/partials/page-footer.html | 34 +++++++++++++++ src/partials/page-header.html | 32 ++++++++++++++ src/partials/page.html | 33 ++++++++++++++ src/partials/social.html | 36 ++++++++-------- src/partials/source-file.html | 4 +- 16 files changed, 171 insertions(+), 95 deletions(-) rename material/partials/{ => javascripts}/outdated.html (100%) create mode 100644 material/partials/page-footer.html create mode 100644 material/partials/page-header.html create mode 100644 material/partials/page.html rename src/partials/{ => javascripts}/outdated.html (100%) create mode 100644 src/partials/page-footer.html create mode 100644 src/partials/page-header.html create mode 100644 src/partials/page.html diff --git a/material/base.html b/material/base.html index a031116ab..72d8705fa 100644 --- a/material/base.html +++ b/material/base.html @@ -160,24 +160,9 @@
{% block content %} - {% if page.edit_url %} - - {% include ".icons/material/pencil.svg" %} - - {% endif %} - {% if not "\x3ch1" in page.content %} -

{{ page.title | d(config.site_name, true)}}

- {% endif %} - {{ page.content }} - {% if page and page.meta and ( - page.meta.git_revision_date_localized or - page.meta.revision_date - ) %} - {% include "partials/source-file.html" %} - {% endif %} - {% endblock %} - {% block disqus %} - {% include "partials/integrations/disqus.html" %} + {% include "partials/page-header.html" %} + {% include "partials/page.html" %} + {% include "partials/page-footer.html" %} {% endblock %}
diff --git a/material/partials/footer.html b/material/partials/footer.html index 45e6893f6..48bbee2c6 100644 --- a/material/partials/footer.html +++ b/material/partials/footer.html @@ -55,7 +55,9 @@ {% endif %} {{ extracopyright }} - {% include "partials/social.html" %} + {% if config.extra.social %} + {% include "partials/social.html" %} + {% endif %} diff --git a/material/partials/outdated.html b/material/partials/javascripts/outdated.html similarity index 100% rename from material/partials/outdated.html rename to material/partials/javascripts/outdated.html diff --git a/material/partials/page-footer.html b/material/partials/page-footer.html new file mode 100644 index 000000000..dc1f23920 --- /dev/null +++ b/material/partials/page-footer.html @@ -0,0 +1,12 @@ +{#- + This file was automatically generated - do not edit +-#} +{% if page and page.meta and ( + page.meta.git_revision_date_localized or + page.meta.revision_date +) %} + {% include "partials/source-file.html" %} +{% endif %} +{% block disqus %} + {% include "partials/integrations/disqus.html" %} +{% endblock %} diff --git a/material/partials/page-header.html b/material/partials/page-header.html new file mode 100644 index 000000000..f454172b6 --- /dev/null +++ b/material/partials/page-header.html @@ -0,0 +1,8 @@ +{#- + This file was automatically generated - do not edit +-#} +{% if page.edit_url %} + + {% include ".icons/material/pencil.svg" %} + +{% endif %} diff --git a/material/partials/page.html b/material/partials/page.html new file mode 100644 index 000000000..b57ba9a94 --- /dev/null +++ b/material/partials/page.html @@ -0,0 +1,7 @@ +{#- + This file was automatically generated - do not edit +-#} +{% if not "\x3ch1" in page.content %} +

{{ page.title | d(config.site_name, true)}}

+{% endif %} +{{ page.content }} diff --git a/material/partials/social.html b/material/partials/social.html index 519d3e5df..74711246a 100644 --- a/material/partials/social.html +++ b/material/partials/social.html @@ -1,17 +1,15 @@ {#- This file was automatically generated - do not edit -#} -{% if config.extra.social %} - -{% endif %} + diff --git a/material/partials/source-file.html b/material/partials/source-file.html index 9108f5ed3..10898c0f2 100644 --- a/material/partials/source-file.html +++ b/material/partials/source-file.html @@ -3,7 +3,7 @@ -#} {% import "partials/language.html" as lang with context %}
-
+
{% if page.meta.git_revision_date_localized %} {{ lang.t("source.file.date.updated") }}: diff --git a/src/base.html b/src/base.html index 7399052c0..35eb65b0a 100644 --- a/src/base.html +++ b/src/base.html @@ -288,48 +288,13 @@ {% endif %} {% endblock %} - +
- - {% block content %} - - - {% if page.edit_url %} - - {% include ".icons/material/pencil.svg" %} - - {% endif %} - - - {% if not "\x3ch1" in page.content %} -

{{ page.title | d(config.site_name, true)}}

- {% endif %} - - - {{ page.content }} - - - {% if page and page.meta and ( - page.meta.git_revision_date_localized or - page.meta.revision_date - ) %} - {% include "partials/source-file.html" %} - {% endif %} - {% endblock %} - - - {% block disqus %} - {% include "partials/integrations/disqus.html" %} + {% include "partials/page-header.html" %} + {% include "partials/page.html" %} + {% include "partials/page-footer.html" %} {% endblock %}
diff --git a/src/partials/footer.html b/src/partials/footer.html index 4b0a16a50..6a3c3c153 100644 --- a/src/partials/footer.html +++ b/src/partials/footer.html @@ -104,7 +104,9 @@
- {% include "partials/social.html" %} + {% if config.extra.social %} + {% include "partials/social.html" %} + {% endif %}
diff --git a/src/partials/outdated.html b/src/partials/javascripts/outdated.html similarity index 100% rename from src/partials/outdated.html rename to src/partials/javascripts/outdated.html diff --git a/src/partials/page-footer.html b/src/partials/page-footer.html new file mode 100644 index 000000000..3adb8f0bb --- /dev/null +++ b/src/partials/page-footer.html @@ -0,0 +1,34 @@ + + + +{% if page and page.meta and ( + page.meta.git_revision_date_localized or + page.meta.revision_date +) %} + {% include "partials/source-file.html" %} +{% endif %} + + +{% block disqus %} + {% include "partials/integrations/disqus.html" %} +{% endblock %} diff --git a/src/partials/page-header.html b/src/partials/page-header.html new file mode 100644 index 000000000..3fa8bfd6f --- /dev/null +++ b/src/partials/page-header.html @@ -0,0 +1,32 @@ + + + +{% if page.edit_url %} + + {% include ".icons/material/pencil.svg" %} + +{% endif %} diff --git a/src/partials/page.html b/src/partials/page.html new file mode 100644 index 000000000..bb6d63b2a --- /dev/null +++ b/src/partials/page.html @@ -0,0 +1,33 @@ + + + +{% if not "\x3ch1" in page.content %} +

{{ page.title | d(config.site_name, true)}}

+{% endif %} + + +{{ page.content }} diff --git a/src/partials/social.html b/src/partials/social.html index 1dddddcff..d917f1437 100644 --- a/src/partials/social.html +++ b/src/partials/social.html @@ -21,22 +21,20 @@ --> -{% if config.extra.social %} - -{% endif %} + diff --git a/src/partials/source-file.html b/src/partials/source-file.html index 17c0688d2..e6fb448b1 100644 --- a/src/partials/source-file.html +++ b/src/partials/source-file.html @@ -22,9 +22,9 @@ {% import "partials/language.html" as lang with context %} - +
-
+