Skip to content

Commit 8d196fe

Browse files
committed
fix(): resolve issue with <a> tag wrapping for <img>
1 parent d2db439 commit 8d196fe

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

_includes/refactor-content.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,15 @@
170170

171171
{% else %}
172172
<!-- make sure the `<img>` is wrapped by `<a>` -->
173-
{% assign _parent = _right | slice: 1, 4 %}
173+
{% assign _parent = _right | remove_first: ">" | strip | slice: 0, 3 %}
174174

175175
{% if _parent == '</a>' %}
176-
<!-- add class to exist <a> tag -->
177-
{% assign _size = _img_content | size | minus: 1 %}
176+
<!-- add class to existing <a> tag -->
177+
{% assign _size = _img_content | strip | size | minus: 1 %}
178178
{% capture _class %}
179179
class="img-link{% unless _lqip %} shimmer{% endunless %}"
180180
{% endcapture %}
181-
{% assign _img_content = _img_content | slice: 0, _size | append: _class | append: '>' %}
181+
{% assign _img_content = _img_content | strip | slice: 0, _size | append: _class | append: '>' %}
182182

183183
{% else %}
184184
<!-- create the image wrapper -->

0 commit comments

Comments
 (0)