我想问下这个怎么设置多个模板? #209
-
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
| 
         模板可以有多个,templates 里面的作用是 define 模板,如果有同名的 define,当然最后结果看起来就只有一个,但是如果你有: 
 然后在 targets 中引用: targets:
   target_abc1:
     url: xxxxxxx
     message:
       text: '{{ template "abc1.content" . }}'
   target_abc2:
     url: xxxx
     message:
       text: '{{ template "abc2.content" . }}' | 
  
Beta Was this translation helpful? Give feedback.
-
| 
         当然为了简单,甚至也可以不使用 templates 指定文件,直接内联模板也可以,比如 targets:
   target_abc1:
     url: xxxxxxx
     message:
       text: 'Hello, this is text abc1'
   target_abc2:
     url: xxxx
     message:
       text: 'Hello, this is text abc2' | 
  
Beta Was this translation helpful? Give feedback.
-
| 
         当然为了简单,甚至也可以不使用 templates 指定文件,直接内联模板也可以,比如 targets:
   target_abc1:
     url: xxxxxxx
     message:
       text: 'Hello, this is text abc1'
   target_abc2:
     url: xxxx
     message:
       text: 'Hello, this is text abc2' | 
  
Beta Was this translation helpful? Give feedback.
-
| 
         建议打开 UI 进行相应的调试: https://github.com/timonwong/prometheus-webhook-dingtalk/blob/main/docs/FAQ_zh.md#%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98  | 
  
Beta Was this translation helpful? Give feedback.

当然为了简单,甚至也可以不使用 templates 指定文件,直接内联模板也可以,比如