Previously, we often embed image into article content or article excerpt, after that we will use a code snippet get a first image from that and made featured image for this article.
| {% assign featured_image = article.excerpt_or_content | escape %} {% if featured_image contains '<img' %} {% assign featured_image = featured_image | split: 'src="' %} {% assign featured_image = featured_image[1] | split: '"' %} {% assign featured_image = featured_image[0] | remove: '//cdn' %} {% assign featured_image = featured_image | remove: 'http:'; %} {% assign featured_image = featured_image | remove: 'https:' %} {{ featured_image | prepend:'//cdn' | img_tag}} {% endif %} |
But...