diff --git a/themes/tabi/templates/macros/list_posts.html b/themes/tabi/templates/macros/list_posts.html index 2076194..714eed4 100644 --- a/themes/tabi/templates/macros/list_posts.html +++ b/themes/tabi/templates/macros/list_posts.html @@ -97,15 +97,37 @@ {% if post.extra.local_image or post.extra.remote_image %}
  • + {% if post.extra.local_image_dark and not post.extra.local_image %} + {{ throw(message="ERROR: `local_image_dark` requires `local_image` to be set in " ~ post.path) }} + {% endif %} + {% if post.extra.remote_image_dark and not post.extra.remote_image %} + {{ throw(message="ERROR: `remote_image_dark` requires `remote_image` to be set in " ~ post.path) }} + {% endif %} {% if post.extra.local_image %} + {% if post.extra.local_image_dark %} + {# Show light image only in light mode, dark image only in dark mode #} + {% set meta_dark = get_image_metadata(path=post.extra.local_image_dark, allow_missing=true) %} + {{ post.extra.local_image_dark }} + {% endif %} {% set meta = get_image_metadata(path=post.extra.local_image, allow_missing=true) %} - {{ post.extra.local_image }} {% elif post.extra.remote_image %} - {{ post.extra.remote_image_dark }} + {% endif %} + {{ post.extra.remote_image }} {% endif %} diff --git a/themes/tabi/templates/partials/cards_pages.html b/themes/tabi/templates/partials/cards_pages.html index 8aaf1ba..59fa47f 100644 --- a/themes/tabi/templates/partials/cards_pages.html +++ b/themes/tabi/templates/partials/cards_pages.html @@ -19,15 +19,38 @@ data-tags="{% for tax_name, terms in page.taxonomies %}{% for term in terms | unique %}{{ term | lower }}{% if not loop.last %},{% endif %}{% endfor %}{% endfor %}" {% endif %}> {% if page.extra.invertible_image %}{% set card_image_class = "card-image invertible-image" %}{% else %}{% set card_image_class = "card-image" %}{% endif %} + {% if page.extra.local_image_dark and not page.extra.local_image %} + {{ throw(message="ERROR: `local_image_dark` requires `local_image` to be set in " ~ page.path) }} + {% endif %} + {% if page.extra.remote_image_dark and not page.extra.remote_image %} + {{ throw(message="ERROR: `remote_image_dark` requires `remote_image` to be set in " ~ page.path) }} + {% endif %} {% if page.extra.local_image %} + {% if page.extra.local_image_dark %} + {# Show light image only in light mode, dark image only in dark mode #} + {% set meta_dark = get_image_metadata(path=page.extra.local_image_dark, allow_missing=true) %} + {{ page.extra.local_image_dark }} + {% endif %} {% set meta = get_image_metadata(path=page.extra.local_image, allow_missing=true) %} - {{ page.extra.local_image }} {% elif page.extra.remote_image %} - {{ page.extra.remote_image_dark }} + {% endif %} + {% set meta = get_image_metadata(path=page.extra.remote_image, allow_missing=true) %} + {{ page.extra.remote_image }} {% else %}