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