Template variables allows you to define variables that can be configured on confluence page while configuring the Macro.
Imagine you have a Confluence page, and you want to embed different YouTube videos on that page. You have two ways to do this:
{url}
in the template. This variable can be configured via the Confluence Html Template Macro.Using a single template with a URL variable makes it easy to manage and update the embedded YouTube videos across your Confluence pages without creating a mess of multiple templates.
Variable Name: Alphanumeric separated by _
and description.
Default Value: Default value for the variable which will be used when not configured in the Macro
Mandatory: Weather it is mandatory to configured in Macro. If mandatory variable is not configured than you will see and error in the Macro.
Default: A default variable means there will be only one variable, and the value entered in the variable text box in Macro config will be directly assigned to it. This is very useful when you have only one variable or when you want to parse variable configurations using your own logic, as having more than one variable would require defining URL query parameters.
In the above screenshot, we have defined a URL variable, which is the default option. Therefore, while configuring, we can directly pass the URL of the YouTube video in the variable, instead of writing it like "url=**https://www.youtube.com/watch?v=N4AYnTZC83I**."
In a nutshell, having a default variable makes things easier to manage and allows you to do cool things with the value you put in the variable box!