Voog.com

load

Loads specific types of objects and assigns them into a variable that is accessible in the template. Valid types of objects are:

Optional attributes:

  • limit
    • limits returned list length. Applies to articles and media_sets
  • tag
    • limits returned list by article tag (value can be string or array). Applies to article and articles

Examples

Find mediaset by title and assign it to variable named "my_gallery".

{% load media_set to "my_gallery" q.media_set.title="Foobar" %}
<h2>{{ my_gallery.title }}</h2>
{% for photo in my_gallery.photos %}
  <img src="{{photo.medium_thumbnail_url}}">
{% endfor %}

Find articles by title and page and assign it to variable named "my_articles".

{% load articles to "my_articles" q.page.id=page.id q.article.title.$starts="Event" s="article.created_at.$desc,article.id.$desc" limit=10 %}
{% for article in my_articles %}
  <div>{{ article.title }}</div>
{% endfor %}

Filter by single article tag.

{% load articles to "my_articles" q.page.id=page.id tag="my tag" s="article.created_at.$desc,article.id.$desc" limit=10 %}
{% for article in my_articles %}
  <div>{{ article.title }}</div>
{% endfor %}

Filter by single article tags.

{% assign my_tags = 'tag1,tag2' | split: ',' %}
{% load articles to "my_articles" q.page.id=page.id tag=my_tags limit=10 %}
{% for article in my_articles %}
  <div>{{ article.title }}</div>
{% endfor %}