From 37377a43e0ae6e316b0001a6955e0a93c10a7936 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Mon, 27 Oct 2025 05:16:47 +0800 Subject: [PATCH 1/2] =?UTF-8?q?Revert=20"refactor:=20avoid=20converting=20?= =?UTF-8?q?media=E2=80=98s=20relative=20paths=20to=20absolute=20paths=20(#?= =?UTF-8?q?2552)"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit b3d7db3cda006a63cdecd718f97d415eab709dc8. --- _includes/media-url.html | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/_includes/media-url.html b/_includes/media-url.html index 407d42187..ea4107502 100644 --- a/_includes/media-url.html +++ b/_includes/media-url.html @@ -15,9 +15,7 @@ {%- if url -%} {% unless url contains ':' %} {%- comment -%} Add media resources subpath prefix {%- endcomment -%} - {% if include.subpath %} - {% assign url = include.subpath | append: '/' | append: url %} - {% endif %} + {% assign url = include.subpath | default: '' | append: '/' | append: url %} {%- comment -%} Prepend CND URL {%- endcomment -%} {% if site.cdn %} From 66bf232951fbe752821b623dc1e7e4e2824c15bf Mon Sep 17 00:00:00 2001 From: Cotes <11371340+cotes2020@users.noreply.github.com> Date: Mon, 27 Oct 2025 05:39:39 +0800 Subject: [PATCH 2/2] fix: avoid duplicate base URL for homepage preview images (#2568) --- _layouts/default.html | 2 +- _layouts/home.html | 39 +++++++++++++++++++++++++++++---------- _layouts/post.html | 1 - 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/_layouts/default.html b/_layouts/default.html index a55bfefe9..f36c6057b 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -25,7 +25,7 @@ layout: compress
- {% if layout.refactor or layout.layout == 'default' %} + {% if layout.layout == 'default' %} {% include refactor-content.html content=content lang=lang %} {% else %} {{ content }} diff --git a/_layouts/home.html b/_layouts/home.html index cb9ab244d..0161ad8fd 100644 --- a/_layouts/home.html +++ b/_layouts/home.html @@ -1,6 +1,5 @@ --- layout: default -refactor: true --- {% include lang.html %} @@ -55,19 +54,39 @@ refactor: true {% if post.image %} {% assign src = post.image.path | default: post.image %} - {% capture src %}{% include media-url.html src=src subpath=post.media_subpath %}{% endcapture %} + + {% if post.media_subpath %} + {% unless src contains '://' %} + {% assign src = post.media_subpath + | append: '/' + | append: src + | replace: '///', '/' + | replace: '//', '/' + %} + {% endunless %} + {% endif %} + + {% if post.image.lqip %} + {% assign lqip = post.image.lqip %} + + {% if post.media_subpath %} + {% unless lqip contains 'data:' %} + {% assign lqip = post.media_subpath + | append: '/' + | append: lqip + | replace: '///', '/' + | replace: '//', '/' + %} + {% endunless %} + {% endif %} + + {% assign lqip_attr = 'lqip="' | append: lqip | append: '"' %} + {% endif %} {% assign alt = post.image.alt | xml_escape | default: 'Preview Image' %} - {% assign lqip = null %} - - {% if post.image.lqip %} - {% capture lqip_url %}{% include media-url.html src=post.image.lqip subpath=post.media_subpath %}{% endcapture %} - {% assign lqip = 'lqip="' | append: lqip_url | append: '"' %} - {% endif %} -
- {{ alt }} + {{ alt }}
{% assign card_body_col = '7' %} diff --git a/_layouts/post.html b/_layouts/post.html index c8c21ef79..698c86cf6 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -1,6 +1,5 @@ --- layout: default -refactor: true panel_includes: - toc tail_includes: