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.
prevnext
{{ macro:prevnext }}
Generates links to the previous and next pages within the current directory level or logical reading order.
search
{{ macro:search }}
Embeds the full-text search input and the necessary UI container for search results. Interactivity is handled via assets/js/search.js.
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.