Make clear that the two example templates must be used together (#48305)

* make clear that the two templates work in conjunction

* PR review changes

* Update docs/sources/alerting/unified-alerting/message-templating/_index.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Update docs/sources/alerting/unified-alerting/message-templating/_index.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* make numbered steps

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
This commit is contained in:
Santiago 2022-04-27 12:43:45 -03:00 committed by GitHub
parent 6be21d66e6
commit 9237729c19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -79,11 +79,11 @@ You can use any of the following built-in template options to embed custom templ
| `default.message` | Provides a formatted summary of firing and resolved alerts. |
| `teams.default.message` | Similar to `default.messsage`, formatted for Microsoft Teams. |
### Custom template examples
### Example of a custom template
Here are a few examples of how to use custom templates.
Here's an example of how to use a custom template. You can also use the default template included in the setup.
Template to render a single alert:
Step 1: Configure a template to render a single alert.
```
{{ define "myalert" }}
@ -110,7 +110,7 @@ Template to render a single alert:
{{ end }}
```
Template to render entire notification message:
Step 2: Configure a template to render entire notification message.
```
{{ define "mymessage" }}
@ -125,6 +125,13 @@ Template to render entire notification message:
{{ end }}
```
Step 3: Add `mymessage` in the notification message field.
```
Alert summary:
{{ template "mymessage" . }}
```
### HTML in message templates
HTML in alerting message templates is escaped. We do not support rendering of HTML in the resulting notification.