feat: Add macros

- New footer macros
- New header macro
- Use macros in partials
This commit is contained in:
sthag 2025-06-19 12:02:06 +02:00
parent 7f84235f08
commit 07f51e80a2
6 changed files with 56 additions and 23 deletions

View file

@ -7,6 +7,7 @@ tags:
{% set pageId = page.fileSlug %} {% set pageId = page.fileSlug %}
{% extends "demo/_main.njk" %} {% extends "demo/_main.njk" %}
{% import "hippie/macros/_footer.njk" as footer %}
{% block title %}Komponenten{% endblock %} {% block title %}Komponenten{% endblock %}
{% block head %} {% block head %}
@ -57,6 +58,10 @@ tags:
<pre class="pre_code"><code>section.sec_main_status</code></pre> <pre class="pre_code"><code>section.sec_main_status</code></pre>
<h2>&lt;h3&gt;</h2> <h2>&lt;h3&gt;</h2>
<h2>&lt;h4&gt;</h2> <h2>&lt;h4&gt;</h2>
<h2>&lt;footer&gt;</h2>
<div style="position:relative;height:256px;background-color:#b7e0f0;">
{{ footer.pinned() }}
</div>
</article> </article>
<article> <article>
<h1 id="grouping">Gruppierung</h1> <h1 id="grouping">Gruppierung</h1>

View file

@ -1,5 +1,5 @@
<!-- maintenance.template --> <!-- maintenance.template -->
{% import "hippie/macros/_footer.njk" as status %} {% import "hippie/macros/_footer.njk" as footer %}
<!DOCTYPE html> <!DOCTYPE html>
<html lang="de" class="{{ pageClass }}" id="{{ pageId }}"> <html lang="de" class="{{ pageClass }}" id="{{ pageId }}">
<head> <head>
@ -21,7 +21,7 @@
<body class="{{ bodyClass }}"> <body class="{{ bodyClass }}">
{% block body %} {% block body %}
{{ status.footer() }} {{ footer.status() }}
{% endblock %} {% endblock %}
</body> </body>
</html> </html>

View file

@ -0,0 +1,23 @@
{% macro status(email = 'admin@domain.tld', app = 'Application', version = 'ver.s.ion', system = 'System Name', domain = 'domain.tld:port') %}
<footer class="pos_abs pin_bottom width_full">
<address class="txt_center">Kontakt:
<a class="lineLink" href="mailto:{{ email }}">{{ email }}</a>
* Server:
{{ app }}/{{ version }}
({{ system }}) * Domain:
{{ domain }}
</address>
</footer>
{% endmacro %}
{% macro pinned(pos = 'bottom') %}
<footer class="pos_abs pin_{{ pos }} pin_right pin_left">
<p class="txt_center">Unten fixiert</p>
</footer>
{% endmacro %}
{% macro main() %}
<footer class="footer_site">
<div id="end"></div>
</footer>
{% endmacro %}

View file

@ -0,0 +1,5 @@
{% macro main() %}
<header class="header_site">
<div id="begin"></div>
</header>
{% endmacro %}

View file

@ -1,4 +1,3 @@
<!-- footer.partial --> <!-- footer.partial -->
<footer class="footer_site"> {% import "hippie/macros/_footer.njk" as footer %}
<div id="end"></div> {{ footer.main() }}
</footer>

View file

@ -1,2 +1,3 @@
<!-- header.partial --> <!-- header.partial -->
<header class="header_site"></header> {% import "hippie/macros/_header.njk" as header %}
{{ header.main() }}