HEIGE-PCloud / DoIt

A clean, elegant and advanced blog theme for Hugo.
https://hugodoit.pages.dev
MIT License
784 stars 195 forks source link

[BUG] Author Avatar not updating #1015

Closed LV-6502 closed 1 year ago

LV-6502 commented 1 year ago

Describe the bug 描述你遇到的错误

Sincere apologies upfront as I am new to Hugo and this is likely user error. I'm trying to update the following icon to reflect the Authors profile: image

I have created a new toml under data/authors "authX.toml" Which contains: avatar = "https://hugodoit.pages.dev/images/avatar.webp"

I then call this in my post with: authors: ["authX"]

However nothing updates. I have also tried the following direct in the config.toml with no luck:

[author]
  name = "authX"
  email = ""
  link = ""
  avatar = "https://hugodoit.pages.dev/images/avatar.webp"
  gravatarEmail = ""

Am I missing something? Thanks in advance, L

Expected behavior 期待的行为

No response

Screenshots 屏幕截图

No response

Build Environment 构建环境

hugo v0.92.2+extended DoIt: version = "0.3.X"

Preview Environment 预览环境

No response

Additional Information 补充信息

No response

HEIGE-PCloud commented 1 year ago

Yeah that icon is not designed to be customised, it's too small to put a picture there so what you have seen is expected behaviour. That said, do you have any better design in mind to display authors' avatars?

LV-6502 commented 1 year ago

Roger, understood!

Good question and without getting too philosophical on design elements: In its current state my first impression was 'they just didn't bother setting a picture for the demo site, let me dig around for the config..'

But knowing its not customisable really makes it redundant? If the authors cannot add a touch of personality next to their names, what purpose does the icon serve?

The only thing that comes to mind is perhaps the option to set an emoji or FontAwesome icon.

For any other noobs like me: Setting up for configurable FontAwesome icons is relatively straight forward:

Note It can only handle one author. You will get errors if you list two authors in a post.. Only good if you're the sole author on the site.

Under ./data/authors/ create your author_X.toml

name = "AuthX"
authorIcon = 'fas fa-solid fa-rocket fa-fw'

Under ./themes/DoIt/layouts/partials/meta/author.html Add to the top:

{{- $author := index $.Site.Data.authors .Params.authors -}}
{{- $icon := dict "Class" $author.authorIcon }}

Ensure "fontawesome: true" in your post.md Now when you call your author in your post: authors: ["author_X"]

It will display the chosen icon: image