fix: missing xml escape for `alt` of preview image (#1113)

Preview image display error when `alt` contains '<' or '>'


Co-authored-by: Cotes Chung <11371340+cotes2020@users.noreply.github.com>
This commit is contained in:
PENEKhun 2023-06-28 15:23:27 +09:00 committed by GitHub
parent 2639f8ed45
commit 8b0fbf5a83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -63,7 +63,7 @@ refactor: true
{% assign src = post.img_path | append: '/' | append: src | replace: '//', '/' %}
{% endunless %}
{% assign alt = post.image.alt | default: 'Preview Image' %}
{% assign alt = post.image.alt | xml_escape | default: 'Preview Image' %}
<img src="{{ src }}" w="17" h="10" alt="{{ alt }}" {{ lqip }}>
{% endif %}

View File

@ -31,7 +31,7 @@ tail_includes:
{% if page.image %}
{% capture src %}src="{{ page.image.path | default: page.image }}"{% endcapture %}
{% capture class %}class="preview-img{% if page.image.no_bg %}{{ ' no-bg' }}{% endif %}"{% endcapture %}
{% capture alt %}alt="{{ page.image.alt | default: "Preview Image" }}"{% endcapture %}
{% capture alt %}alt="{{ page.image.alt | xml_escape | default: "Preview Image" }}"{% endcapture %}
{% capture lqip %}
{% if page.image.lqip %}