Template variables
Every template has four variables: site for the published site, page for the page being produced, theme for your theme's options and texts, and paligo for markup that Paligo adds. A value that isn't set prints as nothing.
site
Variable | Type | Contents |
|---|---|---|
| text | The layout's Site title, or the publication's title if that is empty. |
| text or null | The layout's Site subtitle. |
| URL or null | The layout's Logo. |
| URL or null | The layout's Logo for dark backgrounds. Null means use |
| URL or null | The layout's Logo link URL. Null means link the logo to the site's front page. |
| true or false | The layout's Open logo link in a new tab. Only matters when |
| URL or null | The layout's Favicon. |
| text or null | The footer copyright line, from the layout's Footer copyright, or from Company name and Copyright year. |
| text | The layout's Site base URL, or empty. |
| text | The language code of the page, such as |
|
| The text direction of the publication's language. Null when it isn't set, which means left-to-right. |
| list | The site's languages. See below. |
| list | The navigation tree. See below. |
| object | The links for a top navigation bar. See below. |
| object or null | The portal page's content. Null if the site has no portal page. See below. |
| object | The search engine. |
| object | Texts that Paligo translates into the page's language: |
| text | The layout's Code colours: |
site.languages: one entry for each language, with:
code: the language code, such asde.label: the language's name in that language, such asDeutsch.default:truefor the site's default language.
site.nav: the pages of the publication as a tree, for a navigation menu. Each entry has:
title: the page title.url: the link to the page. Missing if the entry has no page of its own.children: the entries under it, in the same form.current:truefor the page being produced.ancestor:truefor every entry above the current page.
{% macro tree(items) %}
<ul>
{% for item in items %}
<li{% if item.current %} aria-current="page"{% endif %}>
{% if item.url %}<a href="{{ item.url }}">{{ item.title }}</a>{% else %}{{ item.title }}{% endif %}
{% if item.children %}{{ _self.tree(item.children) }}{% endif %}
</li>
{% endfor %}
</ul>
{% endmacro %}
<nav class="sidebar">{{ _self.tree(site.nav) }}</nav>site.topNav: two lists, either of which can be empty:
items: topics whose section has the roletop-nav-link. Each has atitle, aurlandchildren, a list oftitleandurlfor a dropdown.links: the layout's Top navigation links. Each has atitleand aurl.
Show a top bar only when at least one of the lists has entries.
site.portal: the content for the portal page:
heading: the layout's portal heading, or a translated default.featured: the featured topics, each with atitle,slugandurl.sections: the topics to browse, each with atitle,slugandurl.labels: translated texts for the portal:featuredContent,showMoreandshowLess.startPage: the slug of the topic to start reading from, if there is one.
page
Variable | Type | Contents |
|---|---|---|
| text | The page title. |
| HTML | The page's content. Print it with |
| text |
|
| true or false |
|
| text | The page's file name without |
| text | The page's file name, such as |
| list | The headings on the page, for an on-page table of contents. Each has a |
| list | The pages above this one, starting from the top. Each has a |
| object or null | The previous and next pages, each with a |
| text | A plain-text summary of the page, up to 160 characters. |
| URL | The page's canonical URL, when the layout has Add canonical URL turned on. |
| list | The page's taxonomy values. Each has a |
| text |
|
On the portal and search pages, page.content is empty and the lists are empty.
{% if page.prevPage or page.nextPage %}
<nav class="pager">
{% if page.prevPage %}<a rel="prev" href="{{ page.prevPage.url }}">{{ site.strings.navPrev }}: {{ page.prevPage.title }}</a>{% endif %}
{% if page.nextPage %}<a rel="next" href="{{ page.nextPage.url }}">{{ site.strings.navNext }}: {{ page.nextPage.title }}</a>{% endif %}
</nav>
{% endif %}theme
Variable | Contents |
|---|---|
| The value of each theme option for the layout. See Theme options reference. |
| The theme's own texts in the page's language. See Translate a theme. |
paligo
Variable | Contents |
|---|---|
| Markup that must be in every page's |
| Markup that must be at the end of every page's |