feat: add gallery shortcode

This commit is contained in:
st1020 2024-02-26 20:56:08 +08:00
parent 67b58641e5
commit 25361cfd7a
18 changed files with 23 additions and 0 deletions

View file

@ -0,0 +1,11 @@
<div class="not-prose flex flex-wrap gap-2">
{% for asset in page.assets -%}<!---->
{% if asset is matching("[.](jpg|png)$") %}<!---->
{% set image = resize_image(path=asset, width=240, height=180) %}<!---->
{% set asset_name = asset | split(pat="/") | slice(start=-1) | join(sep="/") %}
<a href="{{ get_url(path=page.path ~ asset_name) }}" target="_blank">
<img class="rounded-lg" src="{{ image.url }}" />
</a>
{% endif %}<!---->
{% endfor %}
</div>