theme: remove author deprecation warning #919

This commit is contained in:
Sören Weber 2024-09-21 00:19:40 +02:00
parent 0bfd766acc
commit a1ab7ecb2d
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
2 changed files with 8 additions and 22 deletions

View file

@ -1,19 +1,13 @@
{{- /* based on Hugo 0.125.5 rss.xml */}}
{{- /* Deprecate site.Author.email in favor of site.Params.author.email */}}
{{- /* based on Hugo 0.135.0 rss.xml */}}
{{- $authorEmail := "" }}
{{- if and .Site.Params.author (reflect.IsMap .Site.Params.author) .Site.Params.author.email }}
{{- $authorEmail = .Site.Params.author.email }}
{{- else }}
{{- with .Site.Author.email }}
{{- $authorEmail = . }}
{{- $hugoVersion := "0.120.0" }}
{{- if ge hugo.Version $hugoVersion }}
{{- warnf "The author key in site configuration is deprecated. Use params.author.email instead." }}
{{- with .Site.Params.author }}
{{- if reflect.IsMap . }}
{{- with .email }}
{{- $authorEmail = . }}
{{- end }}
{{- end }}
{{- end }}
{{- /* Deprecate site.Author.name in favor of site.Params.author.name */}}
{{- $authorName := partialCached "_relearn/authorName.gotmpl" . }}
{{- $pages := .Pages }}

View file

@ -1,20 +1,12 @@
{{- $authorName := "" }}
{{- if .Site.Params.author }}
{{- if reflect.IsMap .Site.Params.author }}
{{- with .Site.Params.author.name }}
{{- with .Site.Params.author }}
{{- if reflect.IsMap . }}
{{- with .name }}
{{- $authorName = . }}
{{- end }}
{{- else }}
{{- warnf "DEPRECATED usage of 'params.author' config parameter found, replace it with `params.author.name` in your hugo.toml; see https://mcshelby.github.io/hugo-theme-relearn/basics/releasenotes/5/#5-23-0" }}
{{- $authorName = .Site.Params.author }}
{{- end }}
{{- else }}
{{- with .Site.Author.name }}
{{- $authorName = . }}
{{- $hugoVersion := "0.120.0" }}
{{- if ge hugo.Version $hugoVersion }}
{{- warnf "The author key in site configuration is deprecated. Use params.author.name instead." }}
{{- end }}
{{- end }}
{{- end }}
{{- return $authorName }}