From 79159ef493beab9eca85b0a8d3ad93abe870f4a1 Mon Sep 17 00:00:00 2001 From: dumbmoron Date: Thu, 30 Nov 2023 22:59:42 +0000 Subject: index.json: add pinned issues to output Adds a `pinnedIssues` key to the `index.json` object, which contains issues with `informational` and `pin` set to `true`. --- layouts/index.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'layouts') diff --git a/layouts/index.json b/layouts/index.json index a7ce134..23b8afa 100644 --- a/layouts/index.json +++ b/layouts/index.json @@ -17,6 +17,20 @@ } {{ end }} ], + {{ $informationals := where $incidents "Params.informational" "=" true }}{{ $pinnedIssues := where $informationals "Params.pin" "=" true }} + {{ if not $pinnedIssues }} + "pinnedIssues": []{{ else }} + "pinnedIssues": [{{ range $i, $e := $pinnedIssues }}{{ if $i }},{{ end }} + { + "is": "issue", + "title": "{{ .Title }}", + "createdAt": "{{ .Date }}", + "lastMod": "{{ .Lastmod }}", + "permalink": "{{ .Permalink }}", + "affected": [{{ range $i, $e := .Params.Affected }}{{ if $i }}, {{ end }}"{{ . }}"{{ end }}], + "filename": "{{ .File.LogicalName }}" + }{{ end }} + ]{{ end }}, "systems": [ {{ range $i, $e := .Site.Params.systems }}{{ if $i }},{{ end }} { -- cgit v1.2.3-70-g09d2