fix(home): preview image missing [alt] and img_path (#1044)

Close #1044
This commit is contained in:
Cotes Chung 2023-05-18 05:57:20 +08:00
parent de6ec65932
commit aba9468b53
No known key found for this signature in database
GPG key ID: 0D9E54843167A808

View file

@ -48,7 +48,15 @@ refactor: true
{% if post.image.lqip %}
{% capture lqip %}lqip="{{ post.image.lqip }}"{% endcapture %}
{% endif %}
<img src="{{ post.image.path | default: post.image }}" w="15" h="8" {{ lqip }}>
{% assign src = post.image.path | default: post.image %}
{% unless src contains '//' %}
{% assign src = post.img_path | append: '/' | append: src | replace: '//', '/' %}
{% endunless %}
{% assign alt = post.image.alt | default: 'Preview Image' %}
<img src="{{ src }}" w="15" h="8" alt="{{ alt }}" {{ lqip }}>
{% endif %}
<div class="card-body d-flex flex-column">