Last active
May 8, 2023 14:15
-
-
Save freakdesign/7591230 to your computer and use it in GitHub Desktop.
Get image src from a string in Liquid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% if article.content contains "<img" %} | |
{% assign src = article.content | split: 'src="' %} | |
{% assign src = src[1] | split: '"' | first | replace: '//cdn', 'http://cdn' | replace: 'http:http://', 'http://' | remove: 'https:' %} | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment