a zola theme
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
1.0 KiB

3 years ago
{# {{ img(url="", alt="", caption="", resize=false, allow_tall=false) }} #}
{% set article_width = 1280 %}
3 years ago
{% if resize %}
{% set effective_image = resize_image(path=url, width=article_width, op="fit_width") %}
{% else %}
{% set effective_image = get_image_metadata(path=url) %}
{% endif %}
{% set full_image_url = get_url(path=url) %}
3 years ago
{% set crop_height = config.extra.image_vertical_crop_height | default(value=768) %}
{% set cropped = effective_image.height > crop_height and not allow_tall %}
<figure>
2 years ago
<img
src="{% if resize %}{{ effective_image.url }}{% else %}{{ full_image_url }}{% endif %}"
2 years ago
alt="{{ alt }}"
title="{{ alt }}"
{%- if cropped %}height="{{ crop_height }}" width="{{article_width}}"{% endif %}
>
3 years ago
{% if caption or resize or cropped %}
<div>
{% if caption %}<figcaption>{{ caption | safe }}</figcaption>{% endif %}
{% if resize or cropped %}<a href="{{ full_image_url }}" target="_blank"> full size</a>{% endif %}
3 years ago
</div>
{% endif %}
</figure>