From 07f51e80a239ca87e0888bbc3a78f0ed7769e672 Mon Sep 17 00:00:00 2001 From: sthag Date: Thu, 19 Jun 2025 12:02:06 +0200 Subject: [PATCH] feat: Add macros - New footer macros - New header macro - Use macros in partials --- source/screens/demo/components.njk | 5 +++ source/templates/hippie/_maintenance.njk | 38 ++++++++++---------- source/templates/hippie/macros/_footer.njk | 23 ++++++++++++ source/templates/hippie/macros/_header.njk | 5 +++ source/templates/hippie/partials/_footer.njk | 5 ++- source/templates/hippie/partials/_header.njk | 3 +- 6 files changed, 56 insertions(+), 23 deletions(-) create mode 100644 source/templates/hippie/macros/_footer.njk create mode 100644 source/templates/hippie/macros/_header.njk diff --git a/source/screens/demo/components.njk b/source/screens/demo/components.njk index e6ad058..57da584 100644 --- a/source/screens/demo/components.njk +++ b/source/screens/demo/components.njk @@ -7,6 +7,7 @@ tags: {% set pageId = page.fileSlug %} {% extends "demo/_main.njk" %} +{% import "hippie/macros/_footer.njk" as footer %} {% block title %}Komponenten{% endblock %} {% block head %} @@ -57,6 +58,10 @@ tags:
section.sec_main_status

<h3>

<h4>

+

<footer>

+
+ {{ footer.pinned() }} +

Gruppierung

diff --git a/source/templates/hippie/_maintenance.njk b/source/templates/hippie/_maintenance.njk index 2bbc5e6..0741534 100644 --- a/source/templates/hippie/_maintenance.njk +++ b/source/templates/hippie/_maintenance.njk @@ -1,27 +1,27 @@ -{% import "hippie/macros/_footer.njk" as status %} +{% import "hippie/macros/_footer.njk" as footer %} - - + + - {% block head %} - {{ hippie.titlePrefix }} - {%- block title %}{% endblock %}{{ hippie.titlePostfix }} + {% block head %} + {{ hippie.titlePrefix }} + {%- block title %}{% endblock %}{{ hippie.titlePostfix }} - {% block meta %} - {% include "hippie/partials/_head_meta.njk" %} - {% endblock %} + {% block meta %} + {% include "hippie/partials/_head_meta.njk" %} + {% endblock %} - {% block links %} - - {% endblock %} - {% endblock %} - + {% block links %} + + {% endblock %} + {% endblock %} + - - {% block body %} - {{ status.footer() }} - {% endblock %} - + + {% block body %} + {{ footer.status() }} + {% endblock %} + \ No newline at end of file diff --git a/source/templates/hippie/macros/_footer.njk b/source/templates/hippie/macros/_footer.njk new file mode 100644 index 0000000..4b27499 --- /dev/null +++ b/source/templates/hippie/macros/_footer.njk @@ -0,0 +1,23 @@ +{% macro status(email = 'admin@domain.tld', app = 'Application', version = 'ver.s.ion', system = 'System Name', domain = 'domain.tld:port') %} +
+
Kontakt: + {{ email }} + * Server: + {{ app }}/{{ version }} + ({{ system }}) * Domain: + {{ domain }} +
+
+{% endmacro %} + +{% macro pinned(pos = 'bottom') %} +
+

Unten fixiert

+
+{% endmacro %} + +{% macro main() %} +
+
+
+{% endmacro %} \ No newline at end of file diff --git a/source/templates/hippie/macros/_header.njk b/source/templates/hippie/macros/_header.njk new file mode 100644 index 0000000..19cac15 --- /dev/null +++ b/source/templates/hippie/macros/_header.njk @@ -0,0 +1,5 @@ +{% macro main() %} +
+
+
+{% endmacro %} \ No newline at end of file diff --git a/source/templates/hippie/partials/_footer.njk b/source/templates/hippie/partials/_footer.njk index 30fb517..3b56531 100644 --- a/source/templates/hippie/partials/_footer.njk +++ b/source/templates/hippie/partials/_footer.njk @@ -1,4 +1,3 @@ -
-
-
\ No newline at end of file +{% import "hippie/macros/_footer.njk" as footer %} +{{ footer.main() }} \ No newline at end of file diff --git a/source/templates/hippie/partials/_header.njk b/source/templates/hippie/partials/_header.njk index d21c54c..2531200 100644 --- a/source/templates/hippie/partials/_header.njk +++ b/source/templates/hippie/partials/_header.njk @@ -1,2 +1,3 @@ -
\ No newline at end of file +{% import "hippie/macros/_header.njk" as header %} +{{ header.main() }} \ No newline at end of file