Skip to content

Commit

Permalink
fix: prevent <img> render if no img src
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rise-erpelding committed Oct 27, 2023
1 parent a9ef666 commit 2826c6a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/php/views/page.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

{% block content %}
<div>
<img
src="{{ post.thumbnail.src|resize(960) }}"
{% if post.thumbnail.alt and post.thumbnail.alt|length > 0 %}
alt="{{ post.thumbnail.alt }}"
{% endif %}
/>
{% if post.thumbnail %}
<img
src="{{ post.thumbnail.src|resize(960) }}"
{% if post.thumbnail.alt and post.thumbnail.alt|length > 0 %}
alt="{{ post.thumbnail.alt }}"
{% endif %}
/>
{% endif %}
{{ post.content }}
{# Loads comments.php by default #}
{{ function('comments_template') }}
Expand Down

0 comments on commit 2826c6a

Please sign in to comment.