forked from tylermenard/hugo-json-feed
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.json
More file actions
executable file
·33 lines (33 loc) · 1.21 KB
/
Copy pathindex.json
File metadata and controls
executable file
·33 lines (33 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{
"version": "https://jsonfeed.org/version/1",
"title": {{ .Site.Title | jsonify }},
"home_page_url": {{ .Permalink | jsonify }},
{{ with .OutputFormats.Get "json" -}}
"feed_url": {{ .Permalink | jsonify }},
{{- end }}
{{ if .Site.Params.author -}}
"author": {
"name": {{ .Site.Params.author | jsonify }}
},
{{- end }}
{{ if .Data.Pages }}
"items": [
{{ range $index, $element := first 10 .Data.Pages -}}
{{ if eq $element.Section "blog" -}}
{{ if $index }},{{end}} {
"title": {{ $element.Title | jsonify }},
"id": {{ $element.Permalink | jsonify }},
"url": {{ $element.Permalink | jsonify }},
"summary": {{ $element.Summary | jsonify }},
{{ if eq $element.Type "link"}}
"external_url": {{ $element.Params.link | jsonify }},
{{ end }}
"content_html": {{ $element.Content | jsonify }},
"content_text": {{ $element.Plain | jsonify }},
"date_published": {{ $element.Date.Format "2006-02-01T15:04:05-0700" | jsonify }}
}
{{ end }}
{{ end }}
]
{{ end }}
}