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