Extensions

Extensions provide a convenient way of extending Automad's core functionality with custom PHP code, while still offering the clean syntax of the template language. Extensions are distributed as packages and can be used across all themes of a site. There are two types of extensions: generic extensions and custom pipe functions.

Generic Extensions

Generic extensions allow for developing more complex and customized template functions of any kind, having full access to all content and core features of Automad. They are used in templates like regular functions:

<@ Vendor/Extension { key: 'value' } @>

Custom Pipe Functions

In contrast to generic extensions, custom pipe functions are specifically meant to modify the value of a variable using the pipe operator. They are used in templates like any other pipe function:

@{ variable | Vendor/Name }

Comparison

Custom FunctionGeneric ExtensionCustom Pipe Function
Syntax<@ name { ... } @><@ Vendor/Name { ... } @>@{ var | Vendor/Name }
Defined inA themeA separate packageA separate package
InputOptions and $AutomadOptions and $AutomadThe variable value and parameters
AssetsNoCSS and JS are loaded automaticallyNo
Use in other themeNoYesYes
Inline PHP Generic Extensions