Skip to content

Instantly share code, notes, and snippets.

@DanWebb
Created August 26, 2015 07:50
Show Gist options
  • Save DanWebb/e6dbc8f590c804059fac to your computer and use it in GitHub Desktop.
Save DanWebb/e6dbc8f590c804059fac to your computer and use it in GitHub Desktop.
Extract an image src from an article excerpt
{% 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