1
0
Fork 0
forked from wezm/wezm.net
wezm.net/v2/templates/shortcodes/figure.html
2023-03-31 13:43:52 +10:00

31 lines
1.2 KiB
HTML

{% set figure_class = ["text-center"] %}
{% if border %}
{% set figure_class = figure_class | concat(with="figure-border") %}
{% endif %}
{% if pixelated %}
{% set figure_class = figure_class | concat(with="figure-pixelated") %}
{% endif %}
<figure class="{{ figure_class | join(sep=" ") }}">
<a href="{{ config.base_url }}/{{ link }}">
{% if resize_width %}
{% set image = resize_image(path=image, width=resize_width, op="fit_width", quality=quality | default(value=75)) %}
{% if width %}
<img src="{{ image.url }}" width="{{ width }}" alt="{{ alt }}" />
{% else %}
<img src="{{ image.url }}" alt="{{ alt }}" />
{% endif %}
{% elif resize_height %}
{% set image = resize_image(path=image, height=resize_height, op="fit_height", quality=quality | default(value=75)) %}
{% if height %}
<img src="{{ image.url }}" style="max-height: {{ height }}px" alt="{{ alt }}" />
{% else %}
<img src="{{ image.url }}" alt="{{ alt }}" />
{% endif %}
{% elif width %}
<img src="{{ config.base_url }}/{{ image }}" width="{{ width }}" alt="{{ alt }}" />
{% else %}
<img src="{{ config.base_url }}/{{ image }}" alt="{{ alt }}" />
{% endif %}
</a>
<figcaption>{{ caption }}</figcaption>
</figure>