Voog.com

Blog

Blog is a special type of page, having access to all articles in this blog.

articles

Returns list of all articles in this blog. Each list item is an article object.

has_tags?

Returns true if at least one tag is present in articles of current blog object. On public site and in preview mode, only published articles are taken into account. In editing mode tags of unpublished articles are also included.

latest_articles

Returns 10 latest blog articles. Use latest_n_articles accessor to get appropriate number of articles. Articles are ordered by create date, newer articles first.

latest_n_articles

Returns requested number of latest articles. Replace n with desirable number. Articles are ordered by creation date, newer articles first.

Example
Copy
{% for article in blog.latest_15_articles %}
{{ article.title }}<br/>
{% endfor %}

page

Reference to the page object the blog is on.

Generates link tag for an RSS-feed. Use inside the head tag

Example
Copy
{{ blog.rss_link }}
#=> <link rel="alternate" type="application/rss+xml" title="RSS" href="url/to/blog.rss">

rss_url

Generates url to RSS feed without generating a link tag:

Example
Copy
<a href="{{ blog.rss_url }}">Subscribe to our blog</a>
#=> <a href="url/to/blog.rss">Subscribe to our blog</a>

tags

Returns the list of tags of associated articles of current blog object. Useful for displaying tags of only one blog when multiple blogs are present on page. On public site and in preview mode, only published articles are taken into account. In editing mode tags of unpublished articles are also included.

Example of generating links of blog related tags on blog listing page and matching with tags that are actively selected. 

Example
Copy
{% if blog.has_tags? %}
{% comment %}Get the names of selected tag filters to an array.{% endcomment %}
{% if tags %}
    {% assign selected_tags = tags | map: "name" %}
{% endif %}
 
{% comment %}Render list of links to tags in blog. Display active class if matches an active tag filter{% endcomment %}
{% for tag in blog.tags %}
    <a {% if selected_tags contains tag.name %}class="active"{% endif %} href="/{{ blog.page.path_with_lang }}/tagged/{{ tag.path }}">{{ tag.name }}</a>
  {% endfor %}
{% endif %}

to_json

Serializes the blog into a JSON string.