mirror of
https://github.com/welpo/tabi.git
synced 2025-12-14 19:58:44 +01:00
✨ feat(local_image): introduce dark option for local_image
This commit is contained in:
parent
ab4bcd5695
commit
185a37553f
3 changed files with 21 additions and 2 deletions
|
|
@ -19,8 +19,17 @@
|
|||
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.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) %}
|
||||
<img class="card-image img-dark"
|
||||
alt="{{ page.extra.local_image_dark }}"
|
||||
src="{{ get_url(path=page.extra.local_image_dark) }}"
|
||||
{% if meta_dark.width %}width="{{ meta_dark.width }}"{% endif %}
|
||||
{% if meta_dark.height %}height="{{ meta_dark.height }}"{% endif %}>
|
||||
{% endif %}
|
||||
{% set meta = get_image_metadata(path=page.extra.local_image, allow_missing=true) %}
|
||||
<img class="card-image"
|
||||
<img class="card-image{% if page.extra.local_image_dark %} img-light{% endif %}"
|
||||
alt="{{ page.extra.local_image }}"
|
||||
src="{{ get_url(path=page.extra.local_image) }}"
|
||||
{% if meta.width %}width="{{ meta.width }}"{% endif %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue