From 3603618b4de1b22201b5018f468c0c66a92264fe Mon Sep 17 00:00:00 2001 From: daudix Date: Wed, 18 Sep 2024 02:42:34 +0300 Subject: [PATCH] Allow setting card per page/section --- CHANGELOG.md | 1 + templates/partials/card.html | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 12d2e50..e0209d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add `h1` with page/section title by default. - Add ability to set accent color per page/section. - Add ability to set default theme per page/section. +- Add ability to set metadata card per page/section. - Add active state to footer's "Powered by" links. - Add active state to footnotes' go back button. - Add active state to slider thumb. diff --git a/templates/partials/card.html b/templates/partials/card.html index bc90b28..22f9ba5 100644 --- a/templates/partials/card.html +++ b/templates/partials/card.html @@ -1,6 +1,10 @@ -{%- if page.extra.banner -%} - {%- set card = resize_image(path=page.colocated_path ~ page.extra.banner, width=1200, height=628, op="fill") -%} - {{ card.url }} +{%- if page.extra.card -%} + {{ get_url(path=page.colocated_path ~ page.extra.card) }} +{%- elif section.extra.card -%} + {{ get_url(path=section.colocated_path ~ section.extra.card) }} +{%- elif page.extra.banner -%} + {%- set card = resize_image(path=page.colocated_path ~ page.extra.banner, width=1200, height=628, op="fill") -%} + {{ card.url }} {%- else -%} - {{ get_url(path='card.png') }} + {{ get_url(path='card.png') }} {%- endif -%}