aboutsummaryrefslogtreecommitdiff
path: root/layouts/index.json
blob: c707f5cd576598123785a5dc40fc1a4f88b9e4d7 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
{{ $incidents := where .Site.RegularPages "Params.section" "issue" }}{{ $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": "index",
  "cStateVersion": "5.0.2",
  "apiVersion": "2.0",
  "title": "{{ .Site.Title }}",
  "languageCodeHTML": "{{ .Site.LanguageCode }}",
  "languageCode": "{{ T "languageCode" }}",
  "baseURL": "{{ .Site.BaseURL }}", 
  "description": "{{ .Site.Params.Description }}",
  "summaryStatus": {{ if $isDown }}"down",{{ else }}{{ if $isDisrupted }}"disrupted",{{ else }}{{ if $isNotice }}"notice",{{ else }}"ok",{{ end }}{{ end }}{{ end }} 
  "categories": [{{ range $i, $e := .Site.Params.categories }}{{ if $i }},{{ end }}
      {
        "name": "{{ .name }}",{{ if .description }}
        "description": "{{ .description }}",{{ end }}
        "hideTitle": {{ if .untitled }}true{{ else }}false{{ end }},
        "closedByDefault": {{ if .closed }}true{{ else }}false{{ end }}
      }
    {{ end }}
  ],
  "systems": [
    {{ range $i, $e := .Site.Params.systems }}{{ if $i }},{{ end }}
      {
        "name": "{{ .name }}",{{ if .description }}
        "description": "{{ .description }}",{{ end }}
        "category": "{{ .category }}", 
        {{ $activeComponentIssues := where $active "Params.affected" "intersect" (slice .name) }}{{ $thisIsNotice := where $activeComponentIssues "Params.severity" "=" "notice" }}{{ $thisIsDisrupted := where $activeComponentIssues "Params.severity" "=" "disrupted" }}{{ $thisIsDown := where $activeComponentIssues "Params.severity" "=" "down" }}
        "status": {{ if $thisIsDown }}"down"{{ else }}{{ if $thisIsDisrupted }}"disrupted"{{ else }}{{ if $thisIsNotice }}"notice"{{ else }}"ok"{{ end }}{{ end }}{{ end }},
        {{ if not $activeComponentIssues }}
        "unresolvedIssues": []
        {{ else }}
        "unresolvedIssues": [{{ range $i, $e := $activeComponentIssues }}{{ if $i }},{{ end }}
            {
              "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 }}"
            }
          {{ end }}
        ]{{ end }}
      }{{ end }}
  ],
  {{ if .Site.Params.customTabs }}
  "tabs": [{{ range $i, $e := .Site.Params.customTabs }}{{ if $i }},{{ end }}
      {
        "name": "{{ .name }}", 
        "link": "{{ .description }}"
      }
    {{ end }}
  ],{{ end }}
  
  "buildDate": "{{ now.Format "2006-01-02" }}",
  "buildTime": "{{ now.Format "15:04" }}",
  "buildTimezone": "{{ now.Format "MST" }}",
  "colorBrand": "{{ .Site.Params.Brand }}",
  "colorOk": "{{ .Site.Params.Ok }}",
  "colorDisrupted": "{{ .Site.Params.Disrupted }}",
  "colorDown": "{{ .Site.Params.Down }}",
  "colorNotice": "{{ .Site.Params.Notice }}",
  "alwaysKeepBrandColor": "{{ .Site.Params.alwaysKeepBrandColor }}",
  "logo": "{{ .Site.Params.logo | absURL }}",
  "googleAnalytics": "{{ .Site.Params.googleAnalytics }}"
}