1
Fork 0

Add a root API with all pages

Useful for some helper scripts
This commit is contained in:
Jake Howard 2021-08-05 22:33:35 +01:00
parent 5a80b161cf
commit cabc93dd5d
Signed by: jake
GPG key ID: 57AFB45680EDD477
3 changed files with 10 additions and 1 deletions

View file

@ -1,4 +1,5 @@
---
title: Homepage
outputs: [html, rss, json]
---
Part Developer, Part SysAdmin, Part InfoSec, All Nerd!

View file

@ -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 -}}

8
layouts/index.json Normal file
View file

@ -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 }}