summaryrefslogtreecommitdiffstats
path: root/layouts/_default/list.json.json
diff options
context:
space:
mode:
authorSerghei Iakovlev <egrep@protonmail.ch>2022-07-03 23:53:41 +0200
committerSerghei Iakovlev <egrep@protonmail.ch>2022-07-04 09:09:04 +0200
commitfce52fd0cba815e564b8fbd996e6766337852274 (patch)
tree9ccc3de6cae67e9043aeb8b910204c5946ee9819 /layouts/_default/list.json.json
parentd9d692148f7e8cffe04128ba3026f3b6a70dc50b (diff)
downloadgohugo-theme-ed-fce52fd0cba815e564b8fbd996e6766337852274.tar.gz
Provide template to render pure JSON
Diffstat (limited to 'layouts/_default/list.json.json')
-rw-r--r--layouts/_default/list.json.json44
1 files changed, 0 insertions, 44 deletions
diff --git a/layouts/_default/list.json.json b/layouts/_default/list.json.json
deleted file mode 100644
index f6b89cc..0000000
--- a/layouts/_default/list.json.json
+++ /dev/null
@@ -1,44 +0,0 @@
-{{- $pctx := . -}}
-{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
-
-{{- $pages := slice -}}
-{{- if $.IsHome -}}
- {{- $mainSections := site.Params.mainSections | default (slice "posts") }}
- {{- $pages = where $pctx.RegularPages.ByDate.Reverse "Type" "in" $mainSections -}}
-{{- else if $.IsSection -}}
- {{- $pages = $pctx.RegularPages.ByDate.Reverse -}}
-{{- else -}}
- {{- $pages = $pctx.Pages -}}
-{{- end -}}
-
-{{- $limit := site.Params.feedSize | default 25 -}}
-{{- $pages = $pages | first $limit -}}
-
-{
- "version": "https://jsonfeed.org/version/1.1",
- "title": {{ (partial "title.html" .) | htmlUnescape | jsonify }},
- "home_page_url": {{ printf "%s?utm_source=json_feed" site.BaseURL | absURL | jsonify }},
- {{ with .OutputFormats.Get "JSON" }}"feed_url": {{ .Permalink | absURL | jsonify }},{{ end }}
- {{ with site.Params.description}}"description": {{ site.Params.description | jsonify }},{{ end }}
- {{- $logo := resources.Get (site.Params.assets.logo | default "/img/open-graph-logo.png") }}{{ $logo = $logo.Resize "96x96" }}
- "icon": {{ $logo.Permalink | jsonify }},
- "favicon": {{ $logo.Permalink | jsonify }},
- {{ with site.Author.name }}"authors": [
- {
- "name": {{ . | jsonify }}{{ with site.Author.twitter }},
- "url": {{ (printf "https://twitter.com/%s" . ) | jsonify }}{{ end }}
- }
- ],{{ end }}
- {{ with site.LanguageCode }}"language" : "{{ . }}",{{ end }}{{ $feedsize := site.Params.feedSize | default 25 }}
- "items": [{{ range $i, $ := $pages }}{{ if $i }},{{ end }}
- {
- "id": {{ $uuid := sha1 (.Permalink | absURL)}}"{{substr $uuid 0 8}}-{{substr $uuid 8 4}}-5{{substr $uuid 13 3}}-{{substr $uuid 16 1}}9{{substr $uuid 17 2}}-{{substr $uuid 21 12}}",
- "url": {{ printf "%s?utm_source=json_feed" .Permalink | jsonify }},
- "title": {{ .Title | plainify | chomp | jsonify }},
- "summary": {{ .Summary | plainify | chomp | jsonify }},
- "date_published": {{ .PublishDate.Format "2006-01-02T15:04:05Z07:00" | jsonify }}{{ if ne .Date .Lastmod }},
- "date_modified" : {{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" | jsonify }}{{ end }}
- }
- {{- end }}
- ]
-}