From a44fbbed5e7e00c04eb10208802cdfaca3a8424e Mon Sep 17 00:00:00 2001 From: Nikita Karamov Date: Sat, 5 Apr 2025 16:21:19 +0200 Subject: [PATCH] Add Zola templates --- config.toml | 3 +++ templates/base.html | 19 +++++++++++++++++++ templates/page.html | 8 ++++++++ templates/partials/menu.html | 15 +++++++++++++++ templates/shortcodes/brand.html | 1 + 5 files changed, 46 insertions(+) create mode 100644 templates/base.html create mode 100644 templates/page.html create mode 100644 templates/partials/menu.html create mode 100644 templates/shortcodes/brand.html diff --git a/config.toml b/config.toml index afe053c..0b6463a 100644 --- a/config.toml +++ b/config.toml @@ -9,3 +9,6 @@ base_url = "https://keys.openpgp.org" generate_feeds = true feed_filenames = ["atom.xml"] +[extra] +menu = [ +] diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..b86a385 --- /dev/null +++ b/templates/base.html @@ -0,0 +1,19 @@ + + + + + + + + {{config.title}} + + +
+

{{config.title}}

+ {% block content %}{% endblock content %} +
+
+
+

Background image retrieved from Subtle Patterns under CC BY-SA 3.0

+
+ diff --git a/templates/page.html b/templates/page.html new file mode 100644 index 0000000..e511064 --- /dev/null +++ b/templates/page.html @@ -0,0 +1,8 @@ +{% extends "base.html" %} + +{% block content %} +
+{% include "partials/menu.html" %} +{% if page %}{{ page.content | safe }}{% elif section %}{{ section.content | safe }}{% endif %} +
+{% endblock content %} diff --git a/templates/partials/menu.html b/templates/partials/menu.html new file mode 100644 index 0000000..7fa1735 --- /dev/null +++ b/templates/partials/menu.html @@ -0,0 +1,15 @@ +

+{%- for item in config.extra.menu -%} +{%- if item is ending_with("_index.md") -%} +{%- set item = get_section(path=item, metadata_only=true) -%} +{%- else -%} +{%- set item = get_page(path=item) -%} +{%- endif -%} +{% if not loop.first %} | {% endif -%} +{% if item.path == current_path -%} +{{ item.title }} +{%- else -%} +{{ item.title }} +{%- endif %} +{% endfor %}

+
diff --git a/templates/shortcodes/brand.html b/templates/shortcodes/brand.html new file mode 100644 index 0000000..94f98ac --- /dev/null +++ b/templates/shortcodes/brand.html @@ -0,0 +1 @@ +{{ name | default(value=config.title) }}