In every page template or component there's a number of variables that are always available.
Page object that contains information about currently viewed page.
<!DOCTYPE html>
<html>
<head>
<title>{{ page.title }}</title>
</head>
<body>
...
</body>
</html>
Refer to page object documentation for all attributes available on page.
Site object provides access to global, site-related values, i.e. menu structure or languages on site.
<!DOCTYPE html>
<html>
<head>
<title>{{ page.title }}</title>
<meta name="keywords" content="{{ site.keywords }}">
</head>
<body>
{% for language in site.languages %}
<a href="{{ language.url }}">{{ language.title }}</a>
{% endfor %}
</body>
</html>
Refer to site object documentation for all site related attributes.
To generate absolute URI-s to asset directories (such as directories for images or stylesheets), there are number of convenience variables to generate paths to these directories. Voog has the following conventions to store external files on site:
Example of creating path to image:
<img src="{{ images_path }}/background.png">
Notice that you have to add trailing slash after variable.
Example that links to javascript file:
<script src="{{ javascripts_path }}/jquery-min.js"></script>
<link rel="stylesheet" href="{{ stylesheets_path }}/style.css">
See also stylesheet_link convenience tag to include stylesheets on page template.
Example of creating path to design asset:
<video controls>
<source src="{{ assets_path }}/somevideo.mp4" type="video/mp4">
I'm sorry; your browser doesn't support HTML5 video in MP4 with H.264.
</video>
If your layout code needs to make some decisions based whether user has been logged into CMS or not, you can use these variables which return true when logged in. These variables can be used together with if or unless tags.
Here's a detailed example of adding a background picker only in editmode.
Works nearly the same way as editmode
but returns true only when in preview mode. Returns false when user is logged out.
{% if previewmode %}You are in preview mode!{% endif %}
Returns language code of the user interface when in edit mode. Returns nil
when in preview mode and when user is logged out.
{% if editor_locale == 'en' %}Edit mode message for editor with English interface.{% endif %}
You can create your own variables to be used in templates by using the assign tag.