Skip to main content

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

site.title

text

The layout's Site title, or the publication's title if that is empty.

site.subtitle

text or null

The layout's Site subtitle.

site.logo

URL or null

The layout's Logo.

site.logoDark

URL or null

The layout's Logo for dark backgrounds. Null means use site.logo everywhere.

site.logoLink

URL or null

The layout's Logo link URL. Null means link the logo to the site's front page.

site.logoLinkNewTab

true or false

The layout's Open logo link in a new tab. Only matters when site.logoLink is set.

site.favicon

URL or null

The layout's Favicon.

site.copyright

text or null

The footer copyright line, from the layout's Footer copyright, or from Company name and Copyright year.

site.base_url

text

The layout's Site base URL, or empty.

site.lang

text

The language code of the page, such as en or de-DE.

site.dir

rtl, ltr or null

The text direction of the publication's language. Null when it isn't set, which means left-to-right.

site.languages

list

The site's languages. See below.

site.nav

list

The navigation tree. See below.

site.topNav

object

The links for a top navigation bar. See below.

site.portal

object or null

The portal page's content. Null if the site has no portal page. See below.

site.search

object

The search engine. site.search.backend is none, pagefind (Nexus Search), algolia or coveo. See Search in a theme.

site.strings

object

Texts that Paligo translates into the page's language: searchPlaceholder, navPrev and navNext.

site.codeColors

text

The layout's Code colours: pygments for Syntax style, or theme for Theme colours. With theme, your stylesheet colors highlighted code.

site.languages: one entry for each language, with:

  • code: the language code, such as de.

  • label: the language's name in that language, such as Deutsch.

  • default: true for 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: true for the page being produced.

  • ancestor: true for 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 role top-nav-link. Each has a title, a url and children, a list of title and url for a dropdown.

  • links: the layout's Top navigation links. Each has a title and a url.

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 a title, slug and url.

  • sections: the topics to browse, each with a title, slug and url.

  • labels: translated texts for the portal: featuredContent, showMore and showLess.

  • startPage: the slug of the topic to start reading from, if there is one.

page

Variable

Type

Contents

page.title

text

The page title.

page.content

HTML

The page's content. Print it with {{ page.content }}.

page.type

text

topic, portal or search.

page.home

true or false

true on the publication's first page when the site has no portal page.

page.slug

text

The page's file name without .html.

page.url

text

The page's file name, such as install.html.

page.toc

list

The headings on the page, for an on-page table of contents. Each has a title, an anchor and children.

page.breadcrumbs

list

The pages above this one, starting from the top. Each has a title and a slug.

page.prevPage, page.nextPage

object or null

The previous and next pages, each with a title, slug and url.

page.meta.description

text

A plain-text summary of the page, up to 160 characters.

page.meta.canonical

URL

The page's canonical URL, when the layout has Add canonical URL turned on.

page.taxonomies

list

The page's taxonomy values. Each has a group, a value and, for nested taxonomies, a hierarchy: a list of levels from the top down.

page.search.weight

text

boost or reduce when the topic's search priority has been changed.

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

theme.options

The value of each theme option for the layout. See Theme options reference.

theme.strings

The theme's own texts in the page's language. See Translate a theme.

paligo

Variable

Contents

paligo.head

Markup that must be in every page's <head>. See Theme templates.

paligo.foot

Markup that must be at the end of every page's <body>. See Theme templates.