Skip to content

Commit 2826c6a

Browse files
fix: prevent <img> render if no img src
Fixes a bug from the featured image work that checks to see if there is an image first before adding an image tag to the document.
1 parent a9ef666 commit 2826c6a

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/php/views/page.twig

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
{% block content %}
44
<div>
5-
<img
6-
src="{{ post.thumbnail.src|resize(960) }}"
7-
{% if post.thumbnail.alt and post.thumbnail.alt|length > 0 %}
8-
alt="{{ post.thumbnail.alt }}"
9-
{% endif %}
10-
/>
5+
{% if post.thumbnail %}
6+
<img
7+
src="{{ post.thumbnail.src|resize(960) }}"
8+
{% if post.thumbnail.alt and post.thumbnail.alt|length > 0 %}
9+
alt="{{ post.thumbnail.alt }}"
10+
{% endif %}
11+
/>
12+
{% endif %}
1113
{{ post.content }}
1214
{# Loads comments.php by default #}
1315
{{ function('comments_template') }}

0 commit comments

Comments
 (0)