From 23d77288040ca113dbc797aa2eaff6ba2a32f324 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sun, 14 Apr 2024 15:30:44 +0200 Subject: Move site author configuration to params --- layouts/_default/home.humanstxt.txt | 12 +++++++----- layouts/_default/list.atom.xml | 5 +++-- layouts/_default/list.feed.xml | 3 ++- layouts/_default/list.jsonfeed.json | 6 ++++-- 4 files changed, 16 insertions(+), 10 deletions(-) (limited to 'layouts/_default') diff --git a/layouts/_default/home.humanstxt.txt b/layouts/_default/home.humanstxt.txt index 0d3efe9..23286fe 100644 --- a/layouts/_default/home.humanstxt.txt +++ b/layouts/_default/home.humanstxt.txt @@ -1,11 +1,12 @@ -{{- with site.Author.name }} +{{- $siteAuthor := partial "site-author.html" . -}} +{{- with $siteAuthor.name }} /* TEAM */ Author: {{ . }} -{{- 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 }} +{{- with $siteAuthor.email }}{{ printf "\n Contact: %s" . }}{{ end }} +{{- with $siteAuthor.github }}{{ printf "\n GitHub: @%s" . }}{{ end }} +{{- with $siteAuthor.twitter }}{{ printf "\n Twitter: @%s" . }}{{ end }} +{{- with $siteAuthor.location }}{{ printf "\n From: %s" . }}{{ end }} {{- end }} /* SITE */ @@ -15,3 +16,4 @@ Doctype: HTML5 Standards: HTML5, CSS3, Open Graph protocol, Schema.org Components: Hugo, Ed Theme, Lunr.js + Hugo version: {{ site.Hugo.Version }} diff --git a/layouts/_default/list.atom.xml b/layouts/_default/list.atom.xml index 67ff79b..edc133b 100644 --- a/layouts/_default/list.atom.xml +++ b/layouts/_default/list.atom.xml @@ -15,6 +15,7 @@ {{- $pages = $pages | first $limit -}} {{- $siteLastMod := partial "site-last-mod.html" . -}} +{{- $siteAuthor := partial "site-author.html" . -}} {{- safeHTML "" }} @@ -28,10 +29,10 @@ {{- end -}} {{- end }} {{ $logo := resources.Get (site.Params.assets.logo | default "/img/open-graph-logo.png") }}{{ $logo = $logo.Resize "96x96" }}{{ $logo.Permalink | absURL }} - {{ $logo.Permalink | absURL }}{{ with site.Author.name }} + {{ $logo.Permalink | absURL }}{{ with $siteAuthor.name }} {{ printf `` . | safeHTML }} - {{ with site.Author.email }}{{ . | html }}{{ end }} + {{ with $siteAuthor.email }}{{ . | html }}{{ end }} {{ end }}{{ with site.Params.Copyright }}{{ $copyright := replace . "{year}" now.Year }}{{ $copyright = replace $copyright "©" "©" }} {{ $copyright | plainify }}{{ end }} Hugo{{ if ne $siteLastMod "" }} diff --git a/layouts/_default/list.feed.xml b/layouts/_default/list.feed.xml index 2bc3cb7..ae4366b 100644 --- a/layouts/_default/list.feed.xml +++ b/layouts/_default/list.feed.xml @@ -15,6 +15,7 @@ {{- $pages = $pages | first $limit -}} {{- $siteLastMod := partial "site-last-mod.html" . -}} +{{- $siteAuthor := partial "site-author.html" . -}} {{- printf "" | safeHTML }} ` . | safeHTML }}{{ end }} - Hugo {{ hugo.Version }}{{ with site.Author.name }} + Hugo {{ hugo.Version }}{{ with $siteAuthor.name }} {{ printf `` . | safeHTML }}{{ end }}{{ with site.LanguageCode }} {{ . }}{{ end }}{{ with site.Params.Copyright }}{{ $copyright := replace . "{year}" now.Year }}{{ $copyright = replace $copyright "©" "©" }} {{ $copyright | plainify }}{{ end }}{{ if ne $siteLastMod "" }} diff --git a/layouts/_default/list.jsonfeed.json b/layouts/_default/list.jsonfeed.json index f6b89cc..29c9bf4 100644 --- a/layouts/_default/list.jsonfeed.json +++ b/layouts/_default/list.jsonfeed.json @@ -14,6 +14,8 @@ {{- $limit := site.Params.feedSize | default 25 -}} {{- $pages = $pages | first $limit -}} +{{- $siteAuthor := partial "site-author.html" . -}} + { "version": "https://jsonfeed.org/version/1.1", "title": {{ (partial "title.html" .) | htmlUnescape | jsonify }}, @@ -23,9 +25,9 @@ {{- $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": [ + {{ with $siteAuthor.name }}"authors": [ { - "name": {{ . | jsonify }}{{ with site.Author.twitter }}, + "name": {{ . | jsonify }}{{ with $siteAuthor.twitter }}, "url": {{ (printf "https://twitter.com/%s" . ) | jsonify }}{{ end }} } ],{{ end }} -- cgit v1.2.3