From aba9468b5332802db961166889d4c4a84e404a2c Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Thu, 18 May 2023 05:57:20 +0800 Subject: [PATCH] fix(home): preview image missing `[alt]` and `img_path` (#1044) Close #1044 --- _layouts/home.html | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/_layouts/home.html b/_layouts/home.html index d1be9c3..a5324a6 100644 --- a/_layouts/home.html +++ b/_layouts/home.html @@ -48,7 +48,15 @@ refactor: true {% if post.image.lqip %} {% capture lqip %}lqip="{{ post.image.lqip }}"{% endcapture %} {% endif %} - + + {% 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' %} + + {{ alt }} {% endif %}