Handling Articles

Listing Articles

Publisher have concept of Meta Loaders - one of built in loaders covers articles.

The articles loader parameters:

  • (optional) key route - id or name or array of id’s used for loading meta (if omitted then current route is used).
1
2
3
{% gimmelist article from articles %} <!-- It will use route from context -->
    <img src="{{ url(article) }}" />
{% endgimmelist %}
1
2
3
{% gimmelist article from articles with {'route': 1} %} <!-- route id -->
    <img src="{{ url(article) }}" />
{% endgimmelist %}
1
2
3
{% gimmelist article from articles with {'route': '/news'} %} <!-- route staticPrefix -->
    <img src="{{ url(article) }}" />
{% endgimmelist %}
1
2
3
{% gimmelist article from articles with {'route': ['/news', '/sport/*']} %} <!-- route staticPrefix -->
    <img src="{{ url(article) }}" />
{% endgimmelist %}

Note

'/sport/*' syntax will load articles from main route ('/sport') and all of it 1st level children (eg. '/sport/football').

1
2
3
{% gimmelist article from articles with {'route': [1, 2, 3]} %} <!-- array with routes id -->
    <img src="{{ url(article) }}" />
{% endgimmelist %}
  • (optional) key metadata - It matches article’s metadata, and you can use all metadata fields that are defined for the article, i.e.: language, located etc.
1
2
3
{% gimmelist article from articles with {'metadata':{'language':'en'}} %}
    <img src="{{ url(article) }}" />
{% endgimmelist %}
  • (optional) key keywords - It matches article’s keywords,
1
2
3
{% gimmelist article from articles with {'keywords':['keyword1', 'keyword2']} %}
    <img src="{{ url(article) }}" />
{% endgimmelist %}
  • Filtering out selected articles (useful when you want to exclude articles listed already in content list)
1
2
3
{% gimmelist article from articles without {article:[1,2]} %} <!-- pass articles ids (collected before) -->
    <img src="{{ url(article) }}" />
{% endgimmelist %}
1
2
3
{% gimmelist article from articles without {article:[gimme.article]} %} <!-- pass articles meta objects -->
    <img src="{{ url(article) }}" />
{% endgimmelist %}