Created
February 22, 2018 23:41
-
-
Save gingerrific/4b631c1e6dbbf6eb379a7b292de1a03d to your computer and use it in GitHub Desktop.
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
{% set filteredPosts = posts | selectattr("link") %} | |
{# filter posts to posts that actually contain a link #} | |
{% if filteredPosts and (filteredPosts | length) %} |
{
id:405128,
image:"",
link:"",
link_summary:null,
link_title:null,
message:"Test"
}
{% set filteredPosts = posts | selectattr("link") %}
{% for post in filteredPosts %}
{% if post.link %}
{# do something #}
{% endif %}
{% endfor %}
Is this kind of your thought?
{% set filteredPosts = posts | selectattr("link") %}
{% if filteredPosts %}
{% for post in filteredPosts %}
{# do something #}
{% endfor %}
{% endif %}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
where posts is an array of objects