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
List of available attributes
- analytics
- author
- blogs
- copyright
- title_separator
- title_separator_value
- title_format
- title_format_pattern
- data
- has_favicon?
- header
- keywords
- languages
- latest_articles
- latest_n_articles
- rss_path
- search.enabled
- static_asset_host
- stats_header
- to_json
- url
- root_item
- all_menuitems
- menuitems
- hidden_menuitems
- menuitems_with_hidden
- untranslated_menuitems
- visible_menuitems
- _on_level_*
- blogs
- has_articles?
- latest_articles
- latest_n_articles
- languages
- has_many_languages?
- has_tags?
- all_tags
- has_language_tags?
- language_tags
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.
title_separator
Returns <title>
tag separator override value for site used by title tag. When empty then system default ("–") value is used instead.
title_separator_value
Returns <title>
tag separator value for the site with fallback to system default "–" value.
title_format
Returns <title>
tag format override value for the site used by title tag. When empty then system default value (page_site
) is used instead.
Supported values and their corresponding patterns:
page_site
–<page_title> <separator> <site_title>
site_page
–<site_title> <separator> <page_title>
page
–<page_title>
title_format_pattern
Returns <title>
tag format patten for the site with fallback to system default (<page_title> <separator> <site_title>
) value.
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 the editable tag to enable editing the value.
<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 retrieve an appropriate number of articles. Articles are ordered by creation date, newer articles first.
latest_n_articles
Returns the requested number of latest articles. Replace n with the desired number of articles to return. Articles are ordered by creation 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 requested search functionality on the 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. Note that the hostname is taken from the current request, not the site's primary domain, so depending on which domain is being visited, the output is different and will be cached if any changes are made.
{{ site.url }}
=> http://www.voog.com/
Menu properties
The 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.
menuitems
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.
menuitems_with_hidden
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 the latest_n_articles
accessor to get appropriate number of articles. Articles are ordered by creation date, newer articles first.
latest_n_articles
Returns the requested number of latest articles. Replace n with a desirable number. Articles are ordered by creation 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 a list of published language environments defined in site settings.
has_many_languages?
Returns true if the site has more than one language. Useful for determining visibility of the language menu.
Tags
Currently only blog articles can be tagged.
has_tags?
Returns true if something has been tagged on the site. This is not language-specific, i.e. tags are checked across all languages.
all_tags
Returns the list of tags on site. This is not language-specific, i.e. tags are returned across all languages.
has_language_tags?
Returns true if something has been tagged in site's current language.
language_tags
Returns list of tags in site's current language.
An example of making a tag cloud that directs to site's blog list:
{% for tag in site.language_tags %}
<a href="/{{ site.blogs.first.page.path }}/tagged/{{ tag.path }}">{{ tag.name }}</a>
{% endfor %}