aboutsummaryrefslogtreecommitdiff
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
parent0c25632a7de1cfce8289b654586d56fe39a19ac0 (diff)
downloadthedroneely.com-309d8c1c8a97843fc6187dd3f232d8fb5ea31abe.tar.gz
thedroneely.com-309d8c1c8a97843fc6187dd3f232d8fb5ea31abe.tar.bz2
thedroneely.com-309d8c1c8a97843fc6187dd3f232d8fb5ea31abe.zip
generators/hugo/layouts/_default: Add JSON Feed
-rw-r--r--.gitignore1
-rw-r--r--app/views/partials/footer.php2
-rw-r--r--app/views/snippets/rss.php1
-rw-r--r--generators/hugo/config.yaml4
-rw-r--r--generators/hugo/themes/tdro/layouts/_default/index.json40
5 files changed, 48 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 45087b7..3b5269f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,7 @@ public/abstracts
public/archives
public/bookmarks
public/images
+public/index.json
public/posts
public/projects
public/rss.xml
diff --git a/app/views/partials/footer.php b/app/views/partials/footer.php
index e4c9aac..5f35a25 100644
--- a/app/views/partials/footer.php
+++ b/app/views/partials/footer.php
@@ -11,6 +11,8 @@
<a href="/posts/rss.xml">RSS Feed</a> |
+ <a href="/index.json">JSON Feed</a> |
+
<a href="/resume">Resume</a> |
<a rel="me" href="https://gitlab.com/tdro">Gitlab</a> |
diff --git a/app/views/snippets/rss.php b/app/views/snippets/rss.php
index 1b8b6df..a37df92 100644
--- a/app/views/snippets/rss.php
+++ b/app/views/snippets/rss.php
@@ -1,4 +1,5 @@
<link href="/rss.xml" rel="alternate" type="application/rss+xml" title="All at Thedro Neely"/>
+<link href="/index.json" rel="alternate" type="application/json" title="All at Thedro Neely"/>
<link href="/posts/rss.xml" rel="alternate" type="application/rss+xml" title="Posts at Thedro Neely"/>
<link href="/projects/rss.xml" rel="alternate" type="application/rss+xml" title="Projects at Thedro Neely"/>
<link href="/abstracts/rss.xml" rel="alternate" type="application/rss+xml" title="Abstracts at Thedro Neely"/>
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 }}
+ ]
+}