adityatelange / hugo-PaperMod

A fast, clean, responsive Hugo theme.
https://adityatelange.github.io/hugo-PaperMod/
MIT License
9.9k stars 2.69k forks source link

[BUG] Discrepancy between handling of params.author key in rss and html #1384

Closed schroedingersZombie closed 7 months ago

schroedingersZombie commented 10 months ago

Describe the bug The usage of the params.author key mismatches between rss template and page template. While the rss template expects this key to have the subkeys name and email, the page template expects it to be a list of names or a single name.

Steps to reproduce the behavior: edit hugo.yaml, insert

params:
  author:
    name: me
    email: me@example.com

Expected behavior: The author gets displayed with the post title (maybe even with a mailto: link), while the rss managingEditor gets set.

Actual behavior: While managingEditor gets set correctly, the author under the post title gets rendered as follows: image

I worked around the problem by modifiying layouts/partials/author.html:

{{- if or .Params.author site.Params.author }}
{{- $author := (.Params.author | default site.Params.author) }}
{{- $author_type := (printf "%T" $author) }}
{{- if (or (eq $author_type "[]string") (eq $author_type "[]interface {}")) }}
{{- (delimit $author ", " ) }}
{{- else }}
{{- if (and ($author.name) ($author.email)) }}
<a href="mailto:{{- $author.email}}">{{- $author.name}}</a>
{{- else }}
{{- $author }}
{{- end }}
{{- end }}
{{- end -}}

This still won't work if multiple authors are to be named.

adityatelange commented 7 months ago

Author does not support name and email.

It is supposed to be used as author = ['Person1', 'Person2']. As stated here https://github.com/adityatelange/hugo-PaperMod/wiki/Variables#page-variables

Hugo does not support author config https://github.com/gohugoio/hugo/issues/10551#issuecomment-1358107638