Skip to content

Commit 8b0fbf5

Browse files
PENEKhuncotes2020
andauthored
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>
1 parent 2639f8e commit 8b0fbf5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

_layouts/home.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
{% assign src = post.img_path | append: '/' | append: src | replace: '//', '/' %}
6464
{% endunless %}
6565

66-
{% assign alt = post.image.alt | default: 'Preview Image' %}
66+
{% assign alt = post.image.alt | xml_escape | default: 'Preview Image' %}
6767

6868
<img src="{{ src }}" w="17" h="10" alt="{{ alt }}" {{ lqip }}>
6969
{% endif %}

_layouts/post.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ <h1 data-toc-skip>{{ page.title }}</h1>
3131
{% if page.image %}
3232
{% capture src %}src="{{ page.image.path | default: page.image }}"{% endcapture %}
3333
{% capture class %}class="preview-img{% if page.image.no_bg %}{{ ' no-bg' }}{% endif %}"{% endcapture %}
34-
{% capture alt %}alt="{{ page.image.alt | default: "Preview Image" }}"{% endcapture %}
34+
{% capture alt %}alt="{{ page.image.alt | xml_escape | default: "Preview Image" }}"{% endcapture %}
3535

3636
{% capture lqip %}
3737
{% if page.image.lqip %}

0 commit comments

Comments
 (0)