Website-Redesign/layouts/index.json

24 lines
854 B
JSON
Raw Normal View History

{{ define "main" }}
2021-04-13 02:15:13 -05:00
{
{{ $postsDir := .Site.Params.Posts | default (slice "posts" "post") }}
{{ $postsList := where .Site.RegularPages "Section" "in" $postsDir }}
"page": "{{ .Paginator.PageNumber }}",
"next": {{ if .Paginator.HasNext }}
{{ .Paginator.Next.URL | absURL | jsonify }}
{{ else }}""{{ end }},
2021-04-13 15:33:49 -05:00
{{ $mscratch := newScratch }}
{{ $mscratch.Add "articles" slice }}
{{ range (.Paginate $postsList).Pages }}
{{ $mscratch.Add "articles" (dict
"ignore" (not (in $postsDir .Section))
"title" .Title
"date" (.Date.Format "2006-01-02")
"tags" (or .Params.tags slice)
"summary" .Summary
"link" .Permalink
"image" (or .Params.Image "")) }}
{{ end }}
"articles": {{ $mscratch.Get "articles" | jsonify }}
2021-04-13 02:15:13 -05:00
}
{{ end }}