<divid="default"/>The `default` attribute allows default values for template variables to be used if they're not
specified in the call. It's value is a dictionary of key value pairs where the key is the template variable and the
value is the default value to set it to when not provided.
**A variable cannot be default if it is a conditional variable.**
???+ example "Example"
Click the :fontawesome-solid-circle-plus: icon to learn more
```yaml
templates:
Actor:
default:
my_sync_mode: sync #(1)!
plex_search:
all:
actor: tmdb
tmdb_person: <<person>>
sort_title: "!_<<collection_name>>"
sync_mode: <<my_sync_mode>> #(2)!
collection_order: release
collections:
Bruce Lee:
template:
name: Actor
person: 19429
my_sync_mode: append #(3)!
Chris Pratt:
template: #(4)!
name: Actor
person: 73457
```
1. This sets the default value of the template variable `my_sync_mode` to `sync`.
2. The value for template variable `my_sync_mode` will replace `<<my_sync_mode>>` here.
3. This specifiys that `my_sync_mode` for this definition will be `append`.
4. Since `my_sync_mode` is not passed to this definition the value of `my_sync_mode` will be the default `sync`.
??? blank "`optional` - List of template variables to be removed when not provided.<aclass="headerlink"href="#optional"title="Permanent link">¶</a>"
<divid="optional"/>The `optional` attribute can specify variables that when not specified on the template call
will cause any attribute using one of those variables to be ignored in the template. It's value is a list of
template variables to be considered optional.
**You can make any template variable optional per collection by setting it to `null`.**
**A variable cannot be optional if it is a conditional variable or has a default value.**
???+ example "Example"
Click the :fontawesome-solid-circle-plus: icon to learn more
```yaml
templates:
Actor:
optional:
- my_sync_mode #(1)!
plex_search:
all:
actor: tmdb
tmdb_person: <<person>>
sort_title: "!_<<collection_name>>"
sync_mode: <<my_sync_mode>> #(2)!
collection_order: release
collections:
Bruce Lee:
template:
name: Actor
person: 19429
my_sync_mode: append #(3)!
Chris Pratt:
template: #(4)!
name: Actor
person: 73457
```
1. This sets the template variable `my_sync_mode` as an optional variable.
2. The value for template variable `my_sync_mode` will replace `<<my_sync_mode>>` here or removed as optional.
3. This specifiys that `my_sync_mode` for this definition will be `append`.
4. Since `my_sync_mode` is not passed to this definition it will ignore the entire `sync_mode` attribute in the
template.
??? blank "`conditionals` - Can set template variables based on other template variables.<aclass="headerlink"href="#conditionals"title="Permanent link">¶</a>"
<divid="conditionals"/>Each conditional is identified by its mapping name under the top level `conditionals`
| `conditions` | A list of condition blocks where if all conditions are met then the variable will be the `value` specified in that condition block. Once all conditions in a block are met, that `value` will be used and no other blocks will be run.<br>**This attribute is required** |
| `default` | The default value for when no condition block is met. If default is not specified the variable becomes an optional variable.<br>**This attribute is optional** |
#### Condition Blocks
A condition block consists of one or more key value pairs comparing given template variables to pre supplied static
values.
The key is the name of the template variable who's value you want to compare. While the value is the staic value or
values to compare aginst. Every condition block must also have the `value` key which will be the value of the
template variable if all the conditions in that block are met.
There are three ways to compare values:
1. Using no modifier:
* The given template variable's value must equal the static value or be in the list of static values.
2. Using the not modifier by appending `.not` to the key template variable:
* The given template variable's value must not equal the static value or not be in the list of static values.
3. Using the exists modifier by appending `.exists` to the key template variable:
* While anything but `true` the template variable specified must not exist in the template call.
???+ example "Example"
Click the :fontawesome-solid-circle-plus: icon to learn more
```yaml
templates:
CustomTemplate:
conditionals: #(1)!
offset: #(2)!
default: 15 #(3)!
conditions: #(4)!
- align.exists: false #(5)!
value: 150
- align: center #(6)!
value: 0
- align: [top, bottom] #(7)!
value: 15
key_name: #(8)!
conditions: #(9)!
- style: standards #(10)!
key: 1080
value: Full HD
- style: standards #(11)!
key: 4k
value: Ultra HD
```
1. This is the main `conditionals` attribute to start the whole seciton.
2. This is the main mapping of the conditional template variable `offset`.
3. This sets the default variable of `offset` to `15`.
4. This is the base attribute for the condition blocks.
5. If the variable `align` is not provided to the template then set the variable to `150`.
6. If the variable `align` is passed with the value `center` then set the variable to `0`.
7. If the variable `align` is passed with the value `top` or `bottom` then set the variable to `15`.
8. This is the main mapping of the conditional template variable `key_name`.<br><br>Since `default` is not used
`key_name` will be added to the optional variable list.
9. This is the base attribute for the condition blocks.
10. If the variable `style` is passed with the value `standards` and the variable `key` is passed with the value
`1080` then set the variable to `Full HD`.
11. If the variable `style` is passed with the value `standards` and the variable `key` is passed with the value
`4k` then set the variable to `Ultra HD`.
??? blank "`move_prefix` - List of prefixes to move to the end of the collection/playlist name for sorting.<aclass="headerlink"href="#move-prefix"title="Permanent link">¶</a>"
<divid="move-prefix"/>The `move_prefix` attribute can be used to specify a list or comma-separated string of
prefixes to move to the end of the collection/playlist name for sorting. This changes the template variables
summary: Action film is a genre wherein physical action takes precedence in the storytelling. The film will often have continuous motion and action including physical stunts, chases, fights, battles, and races. The story usually revolves around a hero that has a goal, but is facing incredible odds to obtain it.
summary: Comedy is a genre of film that uses humor as a driving force. The aim of a comedy film is to illicit laughter from the audience through entertaining stories and characters. Although the comedy film may take on some serious material, most have a happy ending. Comedy film has the tendency to become a hybrid sub-genre because humor can be incorporated into many other genres. Comedies are more likely than other films to fall back on the success and popularity of an individual star.
summary: Romantic Comedy is a genre that attempts to catch the viewer’s heart with the combination of love and humor. This sub-genre is light-hearted and usually places the two protagonists in humorous situation. Romantic-Comedy film revolves around a romantic ideal, such as true love. In the end, the ideal triumphs over the situation or obstacle, thus creating a happy ending.
filters:
genre: Comedy
```
Check out the example files in the
[Plex Meta Manager Configs Repository](https://github.com/meisnate12/Plex-Meta-Manager-Configs/tree/master/meisnate12)