1
0
mirror of https://github.com/cotes2020/jekyll-theme-chirpy.git synced 2025-12-18 21:53:26 +00:00

fix: avoid duplicate base URL for homepage preview images (#2568)

This commit is contained in:
Cotes
2025-10-27 05:39:39 +08:00
committed by GitHub
parent 37377a43e0
commit 66bf232951
3 changed files with 30 additions and 12 deletions

View File

@@ -25,7 +25,7 @@ layout: compress
<div class="row flex-grow-1"> <div class="row flex-grow-1">
<main aria-label="Main Content" class="col-12 col-lg-11 col-xl-9 px-md-4"> <main aria-label="Main Content" class="col-12 col-lg-11 col-xl-9 px-md-4">
{% if layout.refactor or layout.layout == 'default' %} {% if layout.layout == 'default' %}
{% include refactor-content.html content=content lang=lang %} {% include refactor-content.html content=content lang=lang %}
{% else %} {% else %}
{{ content }} {{ content }}

View File

@@ -1,6 +1,5 @@
--- ---
layout: default layout: default
refactor: true
--- ---
{% include lang.html %} {% include lang.html %}
@@ -55,19 +54,39 @@ refactor: true
{% if post.image %} {% if post.image %}
{% assign src = post.image.path | default: 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 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 %}
<div class="col-md-5"> <div class="col-md-5">
<img src="{{ src }}" alt="{{ alt }}" {{ lqip }}> <img src="{{ src }}" alt="{{ alt }}" {{ lqip_attr }}>
</div> </div>
{% assign card_body_col = '7' %} {% assign card_body_col = '7' %}

View File

@@ -1,6 +1,5 @@
--- ---
layout: default layout: default
refactor: true
panel_includes: panel_includes:
- toc - toc
tail_includes: tail_includes: