Skip to content

Commit

Permalink
🚨 Fix: the author key in site configuration is deprecated. Use params…
Browse files Browse the repository at this point in the history
….author instead
  • Loading branch information
Lruihao committed Dec 1, 2023
1 parent dc288de commit fb16d9e
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 21 deletions.
2 changes: 1 addition & 1 deletion archetypes/friends.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
7 changes: 7 additions & 0 deletions hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions layouts/index.rss.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
{{- . -}}
</language>
{{- end -}}
{{- with .Site.Author.email -}}
{{- with .Site.Params.author.email -}}
<managingEditor>
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
{{- . }}{{ with $.Site.Params.author.name }} ({{ . }}){{ end -}}
</managingEditor>
<webMaster>
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
{{- . }}{{ with $.Site.Params.author.name }} ({{ . }}){{ end -}}
</webMaster>
{{- end -}}
{{- with .Site.Copyright -}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
{{- /* Author */ -}}
{{- if ne .Site.Params.footer.author false -}}
<span class="author" itemprop="copyrightHolder">
{{ 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) -}}
</span>
{{- end -}}

Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/head/meta.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{- $params := .Scratch.Get "params" -}}

<meta name="author" content="{{ .Site.Author.name }}">
<meta name="author-link" content="{{ .Site.Author.link }}">
<meta name="author" content="{{ .Site.Params.author.name }}">
<meta name="author-link" content="{{ .Site.Params.author.link }}">
<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{ if .IsPage | and .Summary }}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" />

{{- $keywords := .Keywords -}}
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/head/seo.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
{{- with .Site.LanguageCode -}}
"inLanguage": "{{ . }}",
{{- end -}}
{{- with .Site.Author.name -}}
{{- with .Site.Params.author.name -}}
"author": {
"@type": "Person",
"name": {{ . | safeHTML }}
Expand Down Expand Up @@ -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 -}}
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/home/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
{{- $url = .RelPermalink -}}
{{- end -}}
<a href="{{ $url }}"{{ with .Title | default .Name }} title="{{ . }}"{{ end }}{{ if (urls.Parse $url).Host }} rel="noopener noreferrer" target="_blank"{{ end }}>
{{- dict "Src" $avatar "Alt" $.Site.Author.name | partial "plugin/image.html" -}}
{{- dict "Src" $avatar "Alt" $.Site.Params.author.name | partial "plugin/image.html" -}}
</a>
{{- 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 -}}
</div>
{{- end -}}
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/init/patch.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

{{- /* 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 -}}
{{- $authorPost = $params.author -}}
{{- 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 -}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/rss/item.html
Original file line number Diff line number Diff line change
@@ -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 -}}
Expand Down
6 changes: 3 additions & 3 deletions layouts/posts/rss.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
{{- . -}}
</language>
{{- end -}}
{{- with .Site.Author.email -}}
{{- with .Site.Params.author.email -}}
<managingEditor>
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
{{- . }}{{ with $.Site.Params.author.name }} ({{ . }}){{ end -}}
</managingEditor>
<webMaster>
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
{{- . }}{{ with $.Site.Params.author.name }} ({{ . }}){{ end -}}
</webMaster>
{{- end -}}
{{- with .Site.Copyright -}}
Expand Down
6 changes: 3 additions & 3 deletions layouts/taxonomy/rss.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
{{- . -}}
</language>
{{- end -}}
{{- with .Site.Author.email -}}
{{- with .Site.Params.author.email -}}
<managingEditor>
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
{{- . }}{{ with $.Site.Params.author.name }} ({{ . }}){{ end -}}
</managingEditor>
<webMaster>
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
{{- . }}{{ with $.Site.Params.author.name }} ({{ . }}){{ end -}}
</webMaster>
{{- end -}}
{{- with .Site.Copyright -}}
Expand Down

1 comment on commit fb16d9e

@vercel
Copy link

@vercel vercel bot commented on fb16d9e Dec 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

fixit – ./

fixit.lruihao.cn
fixit-git-master-cell-x.vercel.app
fixit-cell-x.vercel.app
hugofixit.vercel.app

Please sign in to comment.