From cabc93dd5daaa502b97bf13ccfda330c3d78f0e3 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 5 Aug 2021 22:33:35 +0100 Subject: [PATCH] Add a root API with all pages Useful for some helper scripts --- content/_index.md | 1 + layouts/_default/search.json | 2 +- layouts/index.json | 8 ++++++++ 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 layouts/index.json diff --git a/content/_index.md b/content/_index.md index 123f467..7cf0d41 100644 --- a/content/_index.md +++ b/content/_index.md @@ -1,4 +1,5 @@ --- title: Homepage +outputs: [html, rss, json] --- Part Developer, Part SysAdmin, Part InfoSec, All Nerd! diff --git a/layouts/_default/search.json b/layouts/_default/search.json index 53a1ef1..9ee6c9b 100644 --- a/layouts/_default/search.json +++ b/layouts/_default/search.json @@ -1,7 +1,7 @@ {{- $result := slice -}} {{- range (where .Site.RegularPages "Section" "!=" "") -}} - {{- $data := dict "title" .Title "content" .Plain "id" (.File.UniqueID) -}} + {{- $data := dict "title" .Title "content" .Plain "id" .File.UniqueID -}} {{- $result = $result | append $data -}} {{- end -}} diff --git a/layouts/index.json b/layouts/index.json new file mode 100644 index 0000000..c3346bd --- /dev/null +++ b/layouts/index.json @@ -0,0 +1,8 @@ +{{- $result := slice -}} + +{{- range .Site.RegularPages -}} + {{- $data := dict "title" .Title "id" .File.UniqueID "url" .Permalink "path" .RelPermalink "section" .Section -}} + {{- $result = $result | append $data -}} +{{- end -}} + +{{ jsonify $result }}