-
Notifications
You must be signed in to change notification settings - Fork 113
Open
Labels
Description
Can jekyll_picture_tag output closed img tags?
{% picture {{ post.image }} preset="thumbnail" %}
produces a void tag like
<img preset="thumbnail" src="/generated/assets/images/my_post.png" srcset="/generated/assets/images/my_post-175-43e233202.webp 175w" sizes="() 100vw">
XML parsers frown on this, e.g when the output gets fed to a newsfeed, it should be
<img preset="thumnail" src=... />
with a closing />
To work around this, I use (*)
{% capture img_tag %}
{% picture {{ post.image }} preset="thumbnail" %}
{% endcapture %}
{% assign img_tag = img_tag | replace: '>', ' />' %}
{{ img_tag | replace: ' />/', '/>' }}
and this seems to work. However, it looks bad, and I think it will fail on a more complex use case. Can jekyll_picture_tag simply close the tag? Or am I missing somthing important?
(*) if its a few images, just manually write the img tag and add the thumbnail to assets
Reactions are currently unavailable