Last active
May 18, 2022 06:58
-
-
Save babsgosgens/cfe94dcbd2e7fdca241b47cdc4ce3edc to your computer and use it in GitHub Desktop.
Use 'where_exp' to filter images from static assets – way shorter than building an array with a loop! See answer by Yuri P here: https://stackoverflow.com/questions/45926668/how-do-i-create-an-array-from-a-forloop
This file contains hidden or 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
{% assign slider_images = "" | split: ',' %} | |
{% for image in site.static_files %} | |
{% if image.path contains page.image_namespace %} | |
{% assign slider_images = slider_images | push: image %} | |
{% endif %} | |
{% endfor %} | |
{% assign slider_images = site.static_files | where_exp: "item", "item.path contains page.image_namespace" %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment