Macros in PureWiki provide a mechanism for embedding dynamic, programmatic functionality directly into themes. They allow theme developers to include complex UI components without writing raw PHP logic within their template files.
Syntax
Macros are invoked using {{ macro:name }} or with an optional parameter: {{ macro:name | parameter }}.
{{ macro:breadcrumbs }}
{{ macro:search | placeholder="Suche..." }}
Available Core Macros
breadcrumbs
{{ macro:breadcrumbs }}
Generates a breadcrumb navigation trail based on the current page's position within the pagetree.json hierarchy. Whether the start page is the first item is set under Global Settings > General > Links & Navigation.
prevnext
{{ macro:prevnext }}
Generates links to the previous and next pages within the current directory level or logical reading order. It is enabled per page in the Page Settings, either for siblings only or including higher levels.
search
{{ macro:search }}
Embeds the full-text search input and the necessary UI container for search results. Interactivity is handled by the script of the theme, which also supports keyboard navigation of the results.
sidebar_toggle
{{ macro:sidebar_toggle }}
Outputs a button to toggle the visibility of the primary sidebar on smaller screens.
lang_switcher
{{ macro:lang_switcher | style }}
e.g. {{ macro:lang_switcher | dropdown }}
Renders a navigation element listing all available language versions for the current page. Only languages for which a published translation exists are shown. If only one language is available, the switcher is hidden automatically. Requires i18n to be enabled in the global settings.
Style: list (default)
The switcher renders a nav class="pw-lang-switcher"element containing one a per available language. The active language link receives the class active. Styling is left to the theme.
Style: dropdown
The switcher renders a select element containing one option per available language.
comments
{{ macro:comments }}
Renders the comments list and submission form on the page if comments are enabled globally and for the specific page. Also displays approved comments.
tags
{{ macro:tags }}
Outputs the tags of the current page as ul class="pw-tag-list" with one li class="pw-tag" per tag. Nothing is rendered for pages without tags. The variable {{ tags }} contains the same markup.