Created
August 26, 2015 07:50
-
-
Save DanWebb/e6dbc8f590c804059fac to your computer and use it in GitHub Desktop.
Extract an image src from an article excerpt
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
{% comment %} | |
This include requires you to pass in the an article excerpt | |
which contains a single image. | |
Example: {% include 'excerpt_image' with article.excerpt %} | |
{% endcomment %} | |
{% assign src = excerpt_image | split: 'src="' %} | |
{% assign src = src[1] | split: '"' %} | |
{% assign src = src[0] %} | |
{{ src }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment