Module Templates

Last updated on June 26, 2024.

With module templates, you can configure modules before deploying them to an environment. For example, you can specify the slug for a page (where the page will be available after the module is installed) upon installing the module.

Configuration

Values for variables have to be provided in the file placed at the top level of the module:

Adding templates to module code

Templates work in deploy mode (with the command) and sync mode (with the command). When the file is present, the finds it and applies its values to the templates. It then sends the output to the server with the resulting file filled in based on the templates.

In both deploy and sync modes, adding templates to module code works similarly. If you have sync mode running and you change the file, then change one of the files using the template, they get processed, and the latest version gets uploaded.

Markup

Everything between and is interpreted as a key to be found in the template configuration file. There is no logic supported; the only available filter is , which unescapes the value provided by the user (by default, they are all escaped).

Example

If you have a page with this code:

And a top-level  with:

During deploy or sync, it will get filled in and sent to the server as follows:

Related Topic

Configuring a Module Template

Have a suggestion for this page?

Didn't quite find what you are looking for or have feedback on how we can make the content better then we would love to hear from you. Please provide us feedback and we will get back to you shortly.