aboutsummaryrefslogtreecommitdiff
path: root/layouts/affected/list.json
blob: 98b8b92177d424befec19c7aa370436c4649e6f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{{ $incidents := .Pages }}{{ $active := where $incidents "Params.resolved" "=" false }}{{ $isNotice := where $active "Params.severity" "=" "notice" }}{{ $isDisrupted := where $active "Params.severity" "=" "disrupted" }}{{ $isDown := where $active "Params.severity" "=" "down" }}{
  "is": "system",
  "title": "{{ .Title }}",
  "permalink": "{{ .Permalink }}",
  "status": {{ if $isDown }}"down",{{ else }}{{ if $isDisrupted }}"disrupted",{{ else }}{{ if $isNotice }}"notice",{{ else }}"ok",{{ end }}{{ end }}{{ end }} 
  "pages": [{{ range $i, $e := .Pages }}{{ if $i }},{{ end }}{{ if eq .Section "issues" }}
      {
        "is": "issue",
        "title": "{{ .Title }}",
        "createdAt": "{{ .Date }}",
        "lastMod": "{{ .Lastmod }}",
        "permalink": "{{ .Permalink }}",
        "severity": "{{ .Params.severity }}",
        "resolved": {{ if .Params.resolved }}true{{ else }}false{{ end }},
        "informational": {{ if .Params.informational }}true{{ else }}false{{ end }},
        "resolvedAt": "{{ .Params.resolvedWhen }}",
        "affected": [{{ range $i, $e := .Params.Affected }}{{ if $i }}, {{ end }}"{{ . }}"{{ end }}],
        "filename": "{{ .File.LogicalName }}"
      }
    {{ else }}
      {
        "is": "page",
        "title": "{{ .Title }}",
        "createdAt": "{{ .Date }}",
        "lastMod": "{{ .Lastmod }}",
        "permalink": "{{ .Permalink }}",
        "filename": "{{ .File.LogicalName }}",
        "summary": {{ jsonify .Summary }}
      }
    {{ end }}{{ end }}
  ]
}