Nginx UI Template provides out-of-the-box configuration templates for users. In `NgxConfigEditor`, we offer a UI where users can quickly insert configurations from the template into the current configuration file.
In this document, we will describe the file format and syntax of it.
The configuration templates are stored in `template/block`, and we welcome you to share your own configuration templates by open a [PR](https://github.com/0xJacky/nginx-ui/pulls).
::: tip
Please note, you need to recompile the backend after modifying or adding new configuration files.
:::
## File Format
Nginx UI Template file consists of two parts: the file header and the actual Nginx configuration.
Below is a configuration template for hotlink protection, which we will use as a basis to introduce the file format and related syntax of Nginx UI Template.
The input boxes and switches in the interface correspond to the variable types `boolean` and `string`.
## Nginx Configuration
The Nginx configuration should be provided after the file header. This part will be parsed using the Go `text/template` library. This library provides powerful template generation capabilities, including conditional judgment, looping, and complex text processing, etc.
For more information, please check [Go Documentation](https://pkg.go.dev/text/template).
The variables defined in the header can be used in this part, such as `.NoneReferer` and `.AllowReferers`.
Please note that you need to define the variables in the header in advance before using them in this part.