Developers

Site

Enables access to site related information including:

  • Menu structure for site (including root item)
  • Available languages on site General RSS-path
  • Latest articles on site
  • Site title

Site properties

These properties give access to extra features on this object.

analytics

Renders statistics service javascript code configured under site settings screen (external tracking code). It is advised to add this property on all page templates at the end of the HTML document. It's rendered into template only in public mode.

<html>
  <body>
    ...
    {{ site.analytics }}
  </body>
</html>

author

Site author name.

blogs

Returns all visible blogs (not hidden from menu) in the current language environment.

{% for blog in site.blogs %}
  <h2>{{ blog.page.title }}</h2>
  {% for article in blog.articles %}
    {{ article.title }}<br/>
  {% endfor %}
{% endfor %}

copyright

Site copyright information.

data

Returns custom data bound to site.

has_favicon?

Returns true if site has uploaded favicon.

header

Returns site header in given language. Should be used on the top of the page. Use editable tag to make it editable.

<html>
  <body>
    <header>{% editable site.header %}</header>
  </body>
</html>

keywords

Site keywords information.

languages

Returns list of published language environments defined under site settings.

latest_articles

Returns 10 latest blog articles on site. 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 create date, newer articles first.

{% for article in site.latest_3_articles %}{{ article.title }}<br>{% endfor %}
{% for article in site.latest_15_articles %}{{ article.title }}<br>{% endfor %}

rss_path

Returns generic RSS-path for site.

search.enabled

Returns true if user has checked to have a search box on site. The default google search widget can be added as follows:

<head>
  <link rel="stylesheet" href="{{ site.static_asset_host }}/libs/edicy-search/latest/edicy-search.css">
</head>
<body>
  <form class="search-form">
    <input type="search"/>
</form>

<script src="{{ site.static_asset_host }}/libs/edicy-search/latest/edicy-search.js"></script>
<script type="text/javascript">
    var search = new VoogSearch($('.search-form').get(0), {
        per_page: 3,
        lang: '{{ page.language_code }}',
        resultsContainer: null, // if given an element results are rendered inside that element instead of modal (with scroll lazy load support)
        sideclick: true, // if modal should close on sideclick
        mobileModeWidth: 480, // mobile checkpoint (adds class "voog-search-mobile-mode" if <=)
        updateOnKeypress: false // updates results on every keypress
    });
</script> </body>

static_asset_host

Returns the URL for the static asset server used for serving tools and optional plugins.
See the example above .

stats_header

Renders header code content configured under site settings screen. It is advised to add this property on all page templates at the end of the HTML head tag. It's rendered into template only in public mode.

<html>
  <head>
    ...
    {{ site.stats_header }}
  </head>
</html>

to_json

Serializes the site object into a JSON string.

url

Returns the URL for current site. Mind you, the hostname is taken from the current request, not from the site's primary domain, so depending on which domain you're visiting from, the output is different and will be cached if any changes are made.

{{ site.url }}

=> http://www.voog.com/

Site also behaves as a root menu item and all its child menu items can be accessed in the same manner.

root_item

Returns menu item object representing top-level item on site structure, known as "Home page" or landing page.

all_menuitems

Returns list of first-level menu items on site including untranslated items.
all_menuitems_with_data - includes page .data attribute.

Returns list of first-level menu items on site.
menuitems_with_data - includes page .data attribute.

hidden_menuitems

Returns all menu items that are hidden. Useful when generating button that groups hidden menuitems together:

{% menubtn site.hidden_menuitems %}

hidden_menuitems_with_data - includes page .data attribute.

Same as menuitems but also returns menu items that are hidden.

menuitems_with_hidden_with_data - includes page .data attribute.

untranslated_menuitems

Returns list of first-level untranslated menu items on site.
untranslated_menuitems_with_data - includes page .data attribute.

visible_menuitems

Returns menu items that are not hidden.

visible_menuitems_with_data - includes page .data attribute.

_on_level_*

All these menuitem methods also take an optional suffix _on_level_*, where * can be a number from 1 to 9. For example, all_menuitems_on_level_2 returns only the second-level menu items.

Blog

blogs

Returns all blogs in current language environment.

{% for blog in site.blogs %}
  <h2>{{ blog.page.title }}</h2>
  {% for article in blog.articles %}
    {{ article.title }}<br/>
  {% endfor %}
{% endfor %}

has_articles?

Return true if site has published articles

latest_articles

Returns 10 latest blog articles on site. 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 create date, newer articles first.

{% for article in site.latest_3_articles %}
  {{ article.title }}<br/>
{% endfor %}
{% for article in site.latest_15_articles %}
  {{ article.title }}<br/>
{% endfor %}

Languages

languages

Returns list of published language environments defined under site settings.

has_many_languages?

Returns true if site has more than one language. Useful for determining visibility of language menu.

Tags

Currently only blog articles can be tagged.

has_tags?

Returns true if something has been tagged in site. Parameter is non language specific checking tags over all languages.

all_tags

Returns list of tag objects on site. Parameter is not language specific returning tags over all languages.

has_language_tags?

Returns true if something has been tagged in sites current language.

language_tags

Returns list of tag objects in sites current language.

Example of making a tag cloud that directs to site blog list page:>

{% for tag in site.language_tags %}
  <a href="/{{ site.blogs.first.page.path }}/tagged/{{ tag.path }}">{{ tag.name }}</a>
{% endfor %}