How do you use the "first" filter?
The Edicy developer site documents a filter "first" and "last" which can return the first or last elements of a passed array. The documented example is:
However, I can't work out for the life of me how to use such a function. "{{ blog.articles | first }}" on its own just returns "#". I assume I need to access the article properties once it's been returned, but how can I do this? I've tried
and everything in-between. None of it works. How do you use this filter?
Thanks.
{{ blog.articles | first }}
However, I can't work out for the life of me how to use such a function. "{{ blog.articles | first }}" on its own just returns "#". I assume I need to access the article properties once it's been returned, but how can I do this? I've tried
{{ blog.articles | first }}.title
{{ {{ blog.articles | first }}.title }}
{% for article in {{ blog.articles | first }} %}
{{ article.title }}
{% endfor %}
{{ blog.articles.title | first }}
{{ blog.articles.article.title | first }}
{{ blog.articles | first.title }}
and everything in-between. None of it works. How do you use this filter?
Thanks.
1
person has this question
I have this question, too!
Tell me when someone answers.
The more people who ask this question, the more it gets noticed.
The more people who ask this question, the more it gets noticed.
Create a customer community for your own organization
Plans starting at $19/month
-
Inappropriate?Hi! I think this one helps you to accomplish your goal:
{% for article in blog.articles %}
{% if forloop.first %}{{ article.title }}{% endif %}
{% endfor %}
There are some other variables available inside for-loop: http://www.edicy.com/developer/templa...
The company says
this answers the question
-
Inappropriate?Hello! And also a good snippet if you want to use a latest post from some certain blog in other page:
{% blogcontext "my_blog_page_name" %}
{% for article in blog.latest_articles limit:1 %}
{{ article.title }}
{{ article.excerpt | truncate:50 }} "{{article.url}}" Read more..
{% endfor %}
{% endblogcontext %}
Loading Profile...



EMPLOYEE
EMPLOYEE