Skip to main content

[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] site.title

[en] text

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

[en] site.subtitle

[en] text or null

[en] The layout's Site subtitle.

[en] site.logo

[en] URL or null

[en] The layout's Logo.

[en] site.logoDark

[en] URL or null

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

[en] site.logoLink

[en] URL or null

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

[en] site.logoLinkNewTab

[en] true or false

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

[en] site.favicon

[en] URL or null

[en] The layout's Favicon.

[en] site.copyright

[en] text or null

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

[en] site.base_url

[en] text

[en] The layout's Site base URL, or empty.

[en] site.lang

[en] text

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

[en] site.dir

[en] rtl, ltr or null

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

[en] site.languages

[en] list

[en] The site's languages. See below.

[en] site.nav

[en] list

[en] The navigation tree. See below.

[en] site.topNav

[en] object

[en] The links for a top navigation bar. See below.

[en] site.portal

[en] object or null

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

[en] site.search

[en] object

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

[en] site.strings

[en] object

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

[en] site.codeColors

[en] text

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

[en] site.languages: one entry for each language, with:

  • [en] code: the language code, such as de.

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

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

  • [en] 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>

[en] site.topNav: two lists, either of which can be empty:

  • [en] 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.

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

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

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

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

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

[en] page

[en] Variable

[en] Type

[en] Contents

[en] page.title

[en] text

[en] The page title.

[en] page.content

[en] HTML

[en] The page's content. Print it with {{ page.content }}.

[en] page.type

[en] text

[en] topic, portal or search.

[en] page.home

[en] true or false

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

[en] page.slug

[en] text

[en] The page's file name without .html.

[en] page.url

[en] text

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

[en] page.toc

[en] list

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

[en] page.breadcrumbs

[en] list

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

[en] page.prevPage, page.nextPage

[en] object or null

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

[en] page.meta.description

[en] text

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

[en] page.meta.canonical

[en] URL

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

[en] page.taxonomies

[en] list

[en] 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.

[en] page.search.weight

[en] text

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

[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] theme.options

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

[en] theme.strings

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

[en] paligo

[en] Variable

[en] Contents

[en] paligo.head

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

[en] paligo.foot

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