- jekyll for loop alternative
- create an array with push
- tagcloud variations
- tagcloud implementation with variation
jekyll for loop alternative
{% assign my_array = site.static_files | where_exp: “item”, “item.path contains ‘assets/images/target-folder’” %}
or:
{% assign target_folder = “assets/images/target-folder” %} {% assign my_array = site.static_files | where_exp: “item”, “item.path contains target_folder” %}
create an array with push
This {% assign my_array = “” %} creates an empty string. One easy way to create an array in Liquid is to split the above:
{% assign my_array = “” | split: ‘,’ %} |
Now you can push items into the array inside a for loop in the following way:
{% for image in site.static_files %} {% if image.path contains “assets/images/target-folder” %} {% assign my_array = my_array | push: image %} {% endif %} {% endfor %}
tagcloud variations
Tag Cloud
{% assign tags = site.tags | sort %} {% for tag in tags %} {{ tag[0] | replace:’-‘, ‘ ‘ }} ({{ tag | last | size }}) {% endfor %}
tagcloud implementation with variation
The following wiki, pages and posts are tagged with
Title | Type | Excerpt |
---|