Skip to content

Instantly share code, notes, and snippets.

@freakdesign
Last active May 8, 2023 14:15
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save freakdesign/7591230 to your computer and use it in GitHub Desktop.
Save freakdesign/7591230 to your computer and use it in GitHub Desktop.
Get image src from a string in Liquid
{% 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