From fb16d9e1a2662d6378e8880bc40aba474ce523c9 Mon Sep 17 00:00:00 2001
From: Cell <1024@lruihao.cn>
Date: Fri, 1 Dec 2023 15:30:54 +0800
Subject: [PATCH] :rotating_light: Fix: the author key in site configuration is
deprecated. Use params.author instead
---
archetypes/friends.md | 2 +-
docs | 2 +-
hugo.toml | 7 +++++++
layouts/index.rss.xml | 6 +++---
layouts/partials/footer.html | 2 +-
layouts/partials/head/meta.html | 4 ++--
layouts/partials/head/seo.html | 4 ++--
layouts/partials/home/profile.html | 4 ++--
layouts/partials/init/patch.html | 4 ++--
layouts/partials/rss/item.html | 2 +-
layouts/posts/rss.xml | 6 +++---
layouts/taxonomy/rss.xml | 6 +++---
12 files changed, 28 insertions(+), 21 deletions(-)
diff --git a/archetypes/friends.md b/archetypes/friends.md
index bd4c99d0..cba8e826 100644
--- a/archetypes/friends.md
+++ b/archetypes/friends.md
@@ -3,7 +3,7 @@ title: {{ replace .TranslationBaseName "-" " " | title }}
subtitle:
type: friends
date: {{ .Date }}
-description: "{{ .Site.Author.name }}'s friends"
+description: "{{ .Site.Params.author.name }}'s friends"
keywords:
- 'Hugo FixIt'
- 'friends template'
diff --git a/docs b/docs
index d89806d2..81b1fc96 160000
--- a/docs
+++ b/docs
@@ -1 +1 @@
-Subproject commit d89806d2acc818414df16a4572a302a158e20b00
+Subproject commit 81b1fc965da7fe93728d717c9f3c75a0a73f4593
diff --git a/hugo.toml b/hugo.toml
index 302be3c9..43abd85e 100644
--- a/hugo.toml
+++ b/hugo.toml
@@ -112,6 +112,13 @@ enableEmoji = true
# You can turn it off, but we would really appreciate if you don’t, as this is a good way to watch FixIt's popularity on the rise.
disableThemeInject = false
+ # Author Configuration
+ [params.author]
+ name = ""
+ email = ""
+ link = ""
+ avatar = ""
+
# FixIt 0.2.0 | NEW App icon config
[params.app]
# optional site title override for the app when added to an iOS home screen or Android launcher
diff --git a/layouts/index.rss.xml b/layouts/index.rss.xml
index 117c4433..8b353881 100644
--- a/layouts/index.rss.xml
+++ b/layouts/index.rss.xml
@@ -15,12 +15,12 @@
{{- . -}}
{{- end -}}
- {{- with .Site.Author.email -}}
+ {{- with .Site.Params.author.email -}}
- {{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
+ {{- . }}{{ with $.Site.Params.author.name }} ({{ . }}){{ end -}}
- {{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
+ {{- . }}{{ with $.Site.Params.author.name }} ({{ . }}){{ end -}}
{{- end -}}
{{- with .Site.Copyright -}}
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index 533a5935..b01c13d0 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -33,7 +33,7 @@
{{- /* Author */ -}}
{{- if ne .Site.Params.footer.author false -}}
- {{ partial "plugin/link.html" (dict "Destination" ($.Site.Author.link | default .Site.Home.RelPermalink) "Content" .Site.Author.name) -}}
+ {{ partial "plugin/link.html" (dict "Destination" ($.Site.Params.author.link | default .Site.Home.RelPermalink) "Content" .Site.Params.author.name) -}}
{{- end -}}
diff --git a/layouts/partials/head/meta.html b/layouts/partials/head/meta.html
index 89080805..6721ee87 100644
--- a/layouts/partials/head/meta.html
+++ b/layouts/partials/head/meta.html
@@ -1,7 +1,7 @@
{{- $params := .Scratch.Get "params" -}}
-
-
+
+
{{- $keywords := .Keywords -}}
diff --git a/layouts/partials/head/seo.html b/layouts/partials/head/seo.html
index 617539ca..9439f714 100644
--- a/layouts/partials/head/seo.html
+++ b/layouts/partials/head/seo.html
@@ -32,7 +32,7 @@
{{- with .Site.LanguageCode -}}
"inLanguage": "{{ . }}",
{{- end -}}
- {{- with .Site.Author.name -}}
+ {{- with .Site.Params.author.name -}}
"author": {
"@type": "Person",
"name": {{ . | safeHTML }}
@@ -70,7 +70,7 @@
{{- /* Page SEO */ -}}
{{- else if .IsPage -}}
- {{- $authorName := .Site.Author.name | default (T "single.author") -}}
+ {{- $authorName := .Site.Params.author.name | default (T "single.author") -}}
{{- with .Params.author -}}
{{- if reflect.IsMap . -}}
{{- $authorName = cond (isset . "name") .name $authorName -}}
diff --git a/layouts/partials/home/profile.html b/layouts/partials/home/profile.html
index 1941b576..e56af6ca 100644
--- a/layouts/partials/home/profile.html
+++ b/layouts/partials/home/profile.html
@@ -28,10 +28,10 @@
{{- $url = .RelPermalink -}}
{{- end -}}
- {{- dict "Src" $avatar "Alt" $.Site.Author.name | partial "plugin/image.html" -}}
+ {{- dict "Src" $avatar "Alt" $.Site.Params.author.name | partial "plugin/image.html" -}}
{{- else -}}
- {{- dict "Src" $avatar "Alt" $.Site.Author.name | partial "plugin/image.html" -}}
+ {{- dict "Src" $avatar "Alt" $.Site.Params.author.name | partial "plugin/image.html" -}}
{{- end -}}
{{- end -}}
diff --git a/layouts/partials/init/patch.html b/layouts/partials/init/patch.html
index af15bd5b..5fb01c5a 100644
--- a/layouts/partials/init/patch.html
+++ b/layouts/partials/init/patch.html
@@ -3,7 +3,7 @@
{{- /* Author data patch */ -}}
{{- $authorDefault := dict "name" "Anonymous" "link" "" "email" "" "avatar" "" -}}
-{{- $author := .Site.Author | merge $authorDefault -}}
+{{- $author := .Site.Params.author | merge $authorDefault -}}
{{- $authorPost := dict -}}
{{- $gravatar := .Site.Params.gravatar -}}
{{- if reflect.IsMap $params.author -}}
@@ -11,7 +11,7 @@
{{- else if isset $params "author" -}}
{{- $authorPost = dict "name" $params.author -}}
{{- end -}}
-{{- if isset $authorPost "name" | and (ne $authorPost.name .Site.Author.name) -}}
+{{- if isset $authorPost "name" | and (ne $authorPost.name .Site.Params.author.name) -}}
{{- $author = $authorPost | merge $authorDefault | merge $author -}}
{{- else -}}
{{- with $authorPost.link -}}{{ $author = dict "link" . | merge $author }}{{- end -}}
diff --git a/layouts/partials/rss/item.html b/layouts/partials/rss/item.html
index e370b42c..b320b5cb 100644
--- a/layouts/partials/rss/item.html
+++ b/layouts/partials/rss/item.html
@@ -1,5 +1,5 @@
{{- $params := .Page.Params | merge .Site.Params.Page -}}
-{{- $authorName := .Site.Author.name | default (T "single.author") -}}
+{{- $authorName := .Site.Params.author.name | default (T "single.author") -}}
{{- with .Params.author -}}
{{- if reflect.IsMap . -}}
{{- $authorName = cond (isset . "name") .name $authorName -}}
diff --git a/layouts/posts/rss.xml b/layouts/posts/rss.xml
index 1c298ba4..7d7f76d4 100644
--- a/layouts/posts/rss.xml
+++ b/layouts/posts/rss.xml
@@ -15,12 +15,12 @@
{{- . -}}
{{- end -}}
- {{- with .Site.Author.email -}}
+ {{- with .Site.Params.author.email -}}
- {{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
+ {{- . }}{{ with $.Site.Params.author.name }} ({{ . }}){{ end -}}
- {{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
+ {{- . }}{{ with $.Site.Params.author.name }} ({{ . }}){{ end -}}
{{- end -}}
{{- with .Site.Copyright -}}
diff --git a/layouts/taxonomy/rss.xml b/layouts/taxonomy/rss.xml
index 50a1e884..d3ac817a 100644
--- a/layouts/taxonomy/rss.xml
+++ b/layouts/taxonomy/rss.xml
@@ -15,12 +15,12 @@
{{- . -}}
{{- end -}}
- {{- with .Site.Author.email -}}
+ {{- with .Site.Params.author.email -}}
- {{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
+ {{- . }}{{ with $.Site.Params.author.name }} ({{ . }}){{ end -}}
- {{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
+ {{- . }}{{ with $.Site.Params.author.name }} ({{ . }}){{ end -}}
{{- end -}}
{{- with .Site.Copyright -}}