fix: use Nunjucks-compatible syntax for URL check

This commit is contained in:
Ricardo
2026-01-28 21:49:26 +01:00
parent faf881b93f
commit 62038aba5f

View File

@@ -21,7 +21,10 @@ permalink: /photos/
{% if post.data.photo %}
<div class="photo-gallery">
{% for img in post.data.photo %}
{% set photoUrl = img.url if img.url.startsWith('/') or img.url.startsWith('http') else '/' + img.url %}
{% set photoUrl = img.url %}
{% if photoUrl and photoUrl[0] != '/' and 'http' not in photoUrl %}
{% set photoUrl = '/' + photoUrl %}
{% endif %}
<a href="{{ post.url }}" class="photo-link">
<img src="{{ photoUrl }}" alt="{{ img.alt | default('Photo') }}" class="u-photo" loading="lazy">
</a>