Skip to content

Instantly share code, notes, and snippets.

@fredryk
Created April 9, 2013 14:33
Show Gist options
  • Save fredryk/5346158 to your computer and use it in GitHub Desktop.
Save fredryk/5346158 to your computer and use it in GitHub Desktop.
Get and display the first image from a Shopify blog article.
{% 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://' %}
<img src="{{ src }}" />
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment