-
-
Save carbone/b82f8ab17dd5a82c6c8a119611a4becb to your computer and use it in GitHub Desktop.
strip liquid image preserve tag
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 the alt tag is empty... | |
{% if product.metafields.custom_fields["test_background_image"] contains 'alt=""' %} | |
{% assign image_url = product.metafields.custom_fields["test_background_image"] | remove: '<img src="' | remove: '" alt="" typeof="foaf:Image" />' %} | |
Image URL: {{ image_url }} | |
{% else %} | |
If the alt tag has a value... | |
{% assign v1 = product.metafields.custom_fields["test_background_image"] | remove: '<img alt="' | split: '" src="'%} | |
{% assign alt = v1[0] %} | |
{% assign image_url = v1[1] | remove: '" typeof="foaf:Image" />'%} | |
Image URL: {{ image_url }} | |
Alt Tag: {{ alt }} | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment