fix: use Nunjucks-compatible syntax for URL check
This commit is contained in:
@@ -21,7 +21,10 @@ permalink: /photos/
|
|||||||
{% if post.data.photo %}
|
{% if post.data.photo %}
|
||||||
<div class="photo-gallery">
|
<div class="photo-gallery">
|
||||||
{% for img in post.data.photo %}
|
{% 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">
|
<a href="{{ post.url }}" class="photo-link">
|
||||||
<img src="{{ photoUrl }}" alt="{{ img.alt | default('Photo') }}" class="u-photo" loading="lazy">
|
<img src="{{ photoUrl }}" alt="{{ img.alt | default('Photo') }}" class="u-photo" loading="lazy">
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
Reference in New Issue
Block a user