> ## Documentation Index
> Fetch the complete documentation index at: https://docs.directgvr.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Templates

> Reuse task definitions with workflow templates.

Every *task*  in the workflow engine supports the *template*  property which allows you to construct the task based on an existing YAML or JSON object.

| Name | Type | Description |
| - | - | - |
| template | string/array of strings | The templates to use to construct the task arguments. |

**Example 1:**

This example show how to use a single template to construct a task.

```json theme={null}
compareA:
  type: stringCompare
  stringOne: a
start:
  template: compareA
  stringTwo: b
  equalTo: runNextTask
```

In the example above the start task is constructed first from it's template, and then from its own properties. The resulting task might look like this:

```json theme={null}
start:
  type: stringCompare
  stringOne: a
  stringTwo: b
  equalTo: runNextTask
```

**Example 2:**

This example shows how to use a list of templates, how to specify a template that might be inside of another object, and how to use expandable strings in template names.

```json theme={null}
logSuccess:
  type: log
  message: success
  so: simple
templates:
  success-win:
    type: log
    message: success-win
    win: 'yes'
  success-mac:
    type: log
    message: success-mac
    mac: 'yes'
start:
  template:
    - logSuccess
    - templates.success-{systemShortName}
  extraneous: value
```

In the example above, when the start task is created, it will look like on the Windows platform:

```json theme={null}
start:
  type: log
  message: success-win
  so: simple
  win: "yes"
  extraneous: value
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.