summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerghei Iakovlev <egrep@protonmail.ch>2022-05-18 00:32:30 +0200
committerSerghei Iakovlev <egrep@protonmail.ch>2022-05-18 00:32:30 +0200
commit474a04eb4d17eff9832ef01656bc70874852715f (patch)
treee417f28c2e41a43b043319357b82dd326f2e8c75
parent58f744a22380c42c25ee4059bb4b2bcfd255fd53 (diff)
downloadgohugo-theme-ed-474a04eb4d17eff9832ef01656bc70874852715f.tar.gz
Improved json feed, add twitter, rework humans.txt
-rw-r--r--exampleSite/config.toml7
-rw-r--r--layouts/_default/home.json.json12
-rw-r--r--layouts/index.humanstxt.txt7
3 files changed, 16 insertions, 10 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 5a3ae85..4fcc7f1 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -53,7 +53,7 @@ disableKinds = ['RSS']
# For more see: https://www.jsonfeed.org/
[outputFormats.JSON]
name = 'Json'
- mediaType = 'application/json'
+ mediaType = 'application/feed+json'
baseName = 'feeds/feed'
rel = 'alternate'
isPlainText = true
@@ -73,11 +73,14 @@ disableKinds = ['RSS']
[mediaTypes]
[mediaTypes.'text/xml']
suffixes = ['xml']
+ [mediaTypes.'application/feed+json']
+ suffixes = ['json']
[author]
name = 'John Doe'
email = 'john@example.com'
- github = '@john_doe'
+ github = 'john_doe'
+ twitter = 'john_doe'
location = 'Kyiv, Ukraine'
[languages]
diff --git a/layouts/_default/home.json.json b/layouts/_default/home.json.json
index 77f5f4d..87d580e 100644
--- a/layouts/_default/home.json.json
+++ b/layouts/_default/home.json.json
@@ -4,13 +4,15 @@
"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" }}
+ {{- $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.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": [{{ $r := first $feedsize (where site.RegularPages.ByDate.Reverse "Type" "in" site.Params.mainSections) }} {{ range $i, $ := $r }}{{ if $i }},{{ end }}
{
diff --git a/layouts/index.humanstxt.txt b/layouts/index.humanstxt.txt
index 93e794b..4b11034 100644
--- a/layouts/index.humanstxt.txt
+++ b/layouts/index.humanstxt.txt
@@ -2,9 +2,10 @@
/* TEAM */
Author: {{ . }}
-{{ with site.Author.email }} Contact: {{ . }}{{ end }}
-{{ with site.Author.github }} GitHub: {{ . }}{{ end }}
-{{ with site.Author.location }} From: {{ . }}{{ end }}
+{{- with site.Author.email }}{{ printf "\n Contact: %s" . }}{{ end }}
+{{- with site.Author.github }}{{ printf "\n GitHub: @%s" . }}{{ end }}
+{{- with site.Author.twitter }}{{ printf "\n Twitter: @%s" . }}{{ end }}
+{{- with site.Author.location }}{{ printf "\n From: %s" . }}{{ end }}
{{- end }}
/* SITE */