summaryrefslogtreecommitdiffstats
path: root/layouts/_default/home.json.json
diff options
context:
space:
mode:
authorSerghei Iakovlev <egrep@protonmail.ch>2022-05-17 21:02:53 +0200
committerSerghei Iakovlev <egrep@protonmail.ch>2022-05-17 21:02:53 +0200
commit58f744a22380c42c25ee4059bb4b2bcfd255fd53 (patch)
treec1d34bf628f1887edf0d4e38e341eaf35f0d6c09 /layouts/_default/home.json.json
parent2e2e603a3ba1923087f949956bbf66456afbe7bf (diff)
downloadgohugo-theme-ed-58f744a22380c42c25ee4059bb4b2bcfd255fd53.tar.gz
Add json feed
Diffstat (limited to 'layouts/_default/home.json.json')
-rw-r--r--layouts/_default/home.json.json26
1 files changed, 26 insertions, 0 deletions
diff --git a/layouts/_default/home.json.json b/layouts/_default/home.json.json
new file mode 100644
index 0000000..77f5f4d
--- /dev/null
+++ b/layouts/_default/home.json.json
@@ -0,0 +1,26 @@
+{
+ "version": "https://jsonfeed.org/version/1.1",
+ "title": {{ (printf "%s JSON Feed" site.Title) | jsonify }},
+ "home_page_url": {{ 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 }}"author":
+ {
+ "name": {{ . | jsonify }}
+ },{{ end }}
+ {{ with site.LanguageCode }}"language" : "{{ . }}",{{ end }}{{ $feedsize := site.Params.feedSize | default 25 }}
+ "items": [{{ $r := first $feedsize (where site.RegularPages.ByDate.Reverse "Type" "in" site.Params.mainSections) }} {{ range $i, $ := $r }}{{ 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": {{ .Permalink | jsonify }},
+ "title": {{ .Title | plainify | chomp | jsonify }},
+ "summary": {{ .Summary | plainify | chomp | jsonify }},
+ "date_published": {{ .PublishDate.UTC.Format site.Params.dateFormatFeed | jsonify }},
+ "date_modified" : {{ .Lastmod.UTC.Format site.Params.dateFormatFeed | jsonify }}
+ }
+ {{- end}}
+ ]
+}