aboutsummaryrefslogtreecommitdiff
path: root/generators
diff options
context:
space:
mode:
authorThedro Neely <thedroneely@gmail.com>2022-04-03 02:18:04 -0400
committerThedro Neely <thedroneely@gmail.com>2022-04-03 02:18:04 -0400
commit309d8c1c8a97843fc6187dd3f232d8fb5ea31abe (patch)
tree8c2316a1642b1eeb907acea3241120deec572abc /generators
parent0c25632a7de1cfce8289b654586d56fe39a19ac0 (diff)
downloadthedroneely.com-309d8c1c8a97843fc6187dd3f232d8fb5ea31abe.tar.gz
thedroneely.com-309d8c1c8a97843fc6187dd3f232d8fb5ea31abe.tar.bz2
thedroneely.com-309d8c1c8a97843fc6187dd3f232d8fb5ea31abe.zip
generators/hugo/layouts/_default: Add JSON Feed
Diffstat (limited to 'generators')
-rw-r--r--generators/hugo/config.yaml4
-rw-r--r--generators/hugo/themes/tdro/layouts/_default/index.json40
2 files changed, 44 insertions, 0 deletions
diff --git a/generators/hugo/config.yaml b/generators/hugo/config.yaml
index 14c5751..45b175c 100644
--- a/generators/hugo/config.yaml
+++ b/generators/hugo/config.yaml
@@ -24,7 +24,11 @@ outputFormats:
rss:
baseName: rss
mediaType: application/xml
+ json:
+ baseName: index
+ mediaType: application/json
outputs:
home:
- rss
+ - json
diff --git a/generators/hugo/themes/tdro/layouts/_default/index.json b/generators/hugo/themes/tdro/layouts/_default/index.json
new file mode 100644
index 0000000..af03997
--- /dev/null
+++ b/generators/hugo/themes/tdro/layouts/_default/index.json
@@ -0,0 +1,40 @@
+{
+ "version": "https://jsonfeed.org/version/1.1",
+ "title": "{{ .Site.Title }}",
+ "home_page_url": "{{ .Site.BaseURL }}",
+ "feed_url": "{{ .Site.BaseURL }}/index.json",
+ "items": [
+ {{- range $index, $data := .Site.Pages -}}
+ {{- if ne $data.Type "json" -}}
+ {{- if and $index (gt $index 0) -}},{{- end }}
+ {
+ "id": "{{ md5 $data.Permalink }}",
+ "url": "{{ $data.Permalink }}",
+ "title": "{{ htmlEscape $data.Title}}",
+ "content_text": {{ $data.Plain | jsonify }},
+ "content_html": {{ $data.Content | jsonify }},
+ "summary": "{{ $data.Summary }}",
+ "date_modified": "{{ $data.Date | time.Format "2006-01-02T15:04:05Z" }}",
+ "date_published": "{{ $data.PublishDate | time.Format "2006-01-02T15:04:05Z" }}",
+ "_metadata": {
+ "slug": "{{ $data.Slug }}",
+ "type": "{{ $data.Type }}"
+ },
+ "author": {
+ "name": "{{ .Site.Author.name }}"
+ },
+ "tags": [
+ {{- range $tags, $tag := $data.Params.tags -}}
+ {{- if $tags -}}
+ ,
+ {{- end -}}
+ "
+ {{- $tag | htmlEscape -}}
+ "
+ {{- end -}}
+ ]
+ }
+ {{- end -}}
+ {{ end }}
+ ]
+}