Make hugo generate a json index of the website

This commit is contained in:
Julien Dessaux 2021-08-23 19:32:05 +02:00
parent 73355d27ed
commit 8df90589bf
2 changed files with 8 additions and 0 deletions

View file

@ -29,6 +29,9 @@ resampleFilter = "CatmullRom"
quality = 75 quality = 75
anchor = "smart" anchor = "smart"
[outputs]
home = ["HTML", "RSS", "JSON"]
[params] [params]
copyright = "Julien (Adyxax) Dessaux" copyright = "Julien (Adyxax) Dessaux"
github_repo = "https://git.adyxax.org/adyxax/www" github_repo = "https://git.adyxax.org/adyxax/www"

5
layouts/index.json Normal file
View file

@ -0,0 +1,5 @@
{{- $.Scratch.Add "index" slice -}}
{{- range .Site.RegularPages -}}
{{- $.Scratch.Add "index" (dict "title" .Title "subtitle" .Params.subtitle "description" .Params.description "tags" .Params.tags "content" .Plain "permalink" .Permalink) -}}
{{- end -}}
{{- $.Scratch.Get "index" | jsonify -}}