From e55841149d9259f26f4d117daba34b5666a52097 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Fri, 11 Sep 2026 22:02:29 +0200 Subject: src/themes/serene: Update to newest version --- .../serene/templates/_components/collection.html | 129 +++++++++++++++++++++ src/themes/serene/templates/_components/prose.html | 72 ++++++++++++ src/themes/serene/templates/_components/seo.html | 39 +++++++ 3 files changed, 240 insertions(+) create mode 100644 src/themes/serene/templates/_components/collection.html create mode 100644 src/themes/serene/templates/_components/prose.html create mode 100644 src/themes/serene/templates/_components/seo.html (limited to 'src/themes/serene/templates/_components') diff --git a/src/themes/serene/templates/_components/collection.html b/src/themes/serene/templates/_components/collection.html new file mode 100644 index 0000000..70a1d31 --- /dev/null +++ b/src/themes/serene/templates/_components/collection.html @@ -0,0 +1,129 @@ +{# + This component is used inside markdown content, which is rendered as a Tera + template first and *then* processed as markdown (zola >= 0.23). Its HTML + output must therefore stay markdown-safe: no blank lines in the middle of + an HTML block, and no lines indented by 4+ spaces. + + Collection file schema: + layout = "card" | "row" | "tile" | "gallery" (default "card") + flow = "stack" | "inline" | "grid" (default: card/gallery -> "stack", row/tile -> "inline") + [[item]] + title / subtitle / content / icon / image / link / badge / tags / featured / rotate +#} + +{% component collection(file: string, section) -%} +{%- set data = load_data(path="content" ~ section.path ~ file, format="toml") -%} +{%- set layout = data.layout if data.layout is defined else "card" -%} +{%- if layout not in ["card", "row", "tile", "gallery"] -%} +{%- set layout = "card" -%} +{%- endif -%} +{%- if data.flow is defined and data.flow in ["stack", "inline", "grid"] -%} +{%- set flow = data.flow -%} +{%- elif layout == "row" or layout == "tile" -%} +{%- set flow = "inline" -%} +{%- else -%} +{%- set flow = "stack" -%} +{%- endif -%} +{%- if layout == "card" and flow == "inline" -%} +{%- set flow = "grid" -%} +{%- endif -%} +
+{%- for item in data.item -%} +{%- set img_src = "" -%} +{%- if item.image is defined -%} +{%- if item.image is starting_with(pat="http") or item.image is starting_with(pat="/") or item.image is starting_with(pat="data:") -%} +{%- set img_src = item.image -%} +{%- else -%} +{%- set img_src = get_url(path=section.colocated_path ~ item.image) -%} +{%- endif -%} +{%- endif -%} +{%- set icon_src = "" -%} +{%- if item.icon is defined -%} +{%- if item.icon is starting_with(pat="http") or item.icon is starting_with(pat="/") or item.icon is starting_with(pat="data:") -%} +{%- set icon_src = item.icon -%} +{%- else -%} +{%- set icon_src = get_url(path=section.colocated_path ~ item.icon) -%} +{%- endif -%} +{%- endif -%} +{%- set external = item.link is defined and not item.link is starting_with(pat="/") -%} +{%- if layout == "card" -%} +
+{%- if img_src -%}
{{ item.title }}
{%- endif -%} +
+
+{%- if icon_src -%}{%- endif -%} +{%- if item.link -%} +{{ item.title }} +{%- else -%} +{{ item.title }} +{%- endif -%} +{%- if item.badge -%}{{ item.badge }}{%- endif -%} +
+{%- if item.subtitle -%} +
{{ item.subtitle | trim | markdown(inline=true) | trim | safe }}
+{%- endif -%} +{%- if item.content -%} +
+{{ item.content | trim | markdown | trim | safe }} +
+{%- endif -%} +{%- if item.tags -%} +
+{%- for tag in item.tags -%} +#{{ tag }} +{%- endfor -%} +
+{%- endif -%} +
+
+{%- elif layout == "row" -%} + + +{%- if icon_src -%}{%- endif -%} +{%- if item.link -%} +{{ item.title }} +{%- else -%} +{{ item.title }} +{%- endif -%} + +{%- if item.subtitle -%}{{ item.subtitle | trim | markdown(inline=true) | trim | safe }}{%- endif -%} +{%- if item.badge -%}{{ item.badge }}{%- endif -%} + +{%- elif layout == "tile" -%} +{%- if item.link -%} + +{%- else -%} + +{%- endif -%} + +{{ item.title }} +{%- if item.subtitle -%}{{ item.subtitle | trim | markdown(inline=true) | trim | safe }}{%- endif -%} + +{%- if img_src -%} +{{ item.title }} +{%- else -%} + +{%- endif -%} +{%- if item.link -%}{%- else -%}{%- endif -%} +{%- elif layout == "gallery" -%} +
+{%- if img_src -%}
{{ item.title }}
{%- endif -%} +
+{%- if item.link -%} +{{ item.title }} +{%- else -%} +{{ item.title }} +{%- endif -%} +{%- if item.subtitle -%}{{ item.subtitle | trim | markdown(inline=true) | trim | safe }}{%- endif -%} +{%- if item.content -%} +
+{{ item.content | trim | markdown | trim | safe }} +
+{%- endif -%} +{%- if item.badge -%}{{ item.badge }}{%- endif -%} +
+
+{%- endif -%} +{%- endfor -%} +
+{%- endcomponent collection %} diff --git a/src/themes/serene/templates/_components/prose.html b/src/themes/serene/templates/_components/prose.html new file mode 100644 index 0000000..c478a58 --- /dev/null +++ b/src/themes/serene/templates/_components/prose.html @@ -0,0 +1,72 @@ +{# + Components in this file are used inside markdown content, which is rendered + as a Tera template first and *then* processed as markdown (zola >= 0.23). + Their HTML output must therefore stay markdown-safe: no blank lines in the + middle of an HTML block, and no lines indented by 4+ spaces. +#} + +{% component back_link(path: string, config) %} +
+ +
+{% endcomponent back_link %} + + +{% component quote(cite: string = "") -%} +{%- set icon = load_data(path="icon/quote.svg") -%} +
+ +
+{{ body | markdown | trim | safe }} +
+{%- if cite -%} +{%- set from_text = "— " ~ cite -%} +
+{{ from_text | markdown | trim | safe }} +
+{%- endif -%} +
+{%- endcomponent quote %} + + +{% component detail(title: string = "", default_open: bool = false) -%} + +{{ title }} +{{ body | markdown | trim | safe }} + +{%- endcomponent detail %} + + +{% component figure(src: string, alt: string = "", caption: string = "", width: string = "", height: string = "", page = {}, section = {}) -%} +{%- if src is starting_with(pat="/") or src is starting_with(pat="http://") or src is starting_with(pat="https://") or src is starting_with(pat="//") or src is starting_with(pat="data:") -%} +{%- set image_src = src -%} +{%- elif page?.colocated_path -%} +{%- set image_src = get_url(path=page.colocated_path ~ src) -%} +{%- elif section?.colocated_path -%} +{%- set image_src = get_url(path=section.colocated_path ~ src) -%} +{%- else -%} +{%- set image_src = src -%} +{%- endif -%} +
+ +{%- if caption -%} +
{{ caption | trim | markdown | trim | safe }}
+{%- endif -%} +
+{%- endcomponent figure %} + + +{% component mermaid() -%} +
+{{ body }}
+
+{%- endcomponent mermaid %} + + +{% component youtube(id: string, autoplay: bool = false) -%} +
+ +
+{%- endcomponent youtube %} diff --git a/src/themes/serene/templates/_components/seo.html b/src/themes/serene/templates/_components/seo.html new file mode 100644 index 0000000..361d7d2 --- /dev/null +++ b/src/themes/serene/templates/_components/seo.html @@ -0,0 +1,39 @@ +{% component seo(title, desc, config, url = "", page_type = "website", image = "", colocated_path = "", published = "", updated = "", tags = [], lang = "") %} +{%- set og_image = "" -%} +{%- if image -%} + {%- if image is starting_with(pat="http://") or image is starting_with(pat="https://") or image is starting_with(pat="//") -%} + {%- set og_image = image -%} + {%- elif image is starting_with(pat="/") -%} + {%- set og_image = get_url(path=image) -%} + {%- elif colocated_path -%} + {%- set og_image = get_url(path=colocated_path ~ image) -%} + {%- else -%} + {%- set og_image = get_url(path=image) -%} + {%- endif -%} +{%- elif config.extra.og_image -%} + {%- if config.extra.og_image is starting_with(pat="http://") or config.extra.og_image is starting_with(pat="https://") or config.extra.og_image is starting_with(pat="//") -%} + {%- set og_image = config.extra.og_image -%} + {%- else -%} + {%- set og_image = get_url(path=config.extra.og_image) -%} + {%- endif -%} +{%- endif -%} + +{% if url %}{% endif %} + + + + +{% if url %}{% endif %} +{% if lang %}{% endif %} +{% if og_image %}{% endif %} +{% if page_type == "article" %} +{% if published %}{% endif %} +{% if updated %}{% endif %} +{% if tags %}{% for tag in tags %} +{% endfor %}{% endif %} +{% endif %} + + + +{% if og_image %}{% endif %} +{% endcomponent seo %} -- cgit v1.3.1