xianmin / hugo-theme-jane

A readable & concise theme for Hugo
https://xianmin.github.io/hugo-theme-jane/
MIT License
918 stars 285 forks source link

Site.Author is deprecated in favour of Params.author in Hugo v0.120.2 #369

Closed paskal closed 8 months ago

paskal commented 9 months ago

Hello!

hugo with version 0.120.2 and newer says following on the build:

WARN  The author key in site configuration is deprecated. Use params.author.email instead.
WARN  The author key in site configuration is deprecated. Use params.author.name instead.

This theme should be altered to use Params.author as a fallback if Site.Author (keys name, email and url) is absent. The problem is that Params.author is already used as a substitute for Site.Author.name in this theme, so it would be a breaking change to remove all the old key usages in favour of using only Params.author.name and Site.Author.name.

I'll prepare the changes, and I guess I'll add throwing an error if Params.author is present as a string so that it will break explicitly and the theme users would be fully aware of what they need to change to make it work.

ventz commented 8 months ago

Came here to post about exactly this too! (@paskal Thank you for the detailed description.)

paskal commented 8 months ago

Figuring out if Params.author is set but is string and not a trivial task, see reflect.IsMap and this discussion for reference.

xianmin commented 8 months ago

Thank you @paskal for fixing this issue, it has been merged into master. sorry for the late reply......

xianmin commented 8 months ago

@paskal There's a bug in the config that you've changed.

  [params.author]
    name = "Jane"      # essential                     # 必需
    url = "/about"        # optional                      # 可选

  logoTitle = "Jane"        # default: the title value    # 默认值: 上面设置的title值
  keywords = ["Hugo", "theme","jane"]
  description = "Hugo theme jane example site."

the logoTitle & keywords & description & etc. will be parsed as params.author.logoTitle & params.author.keywords ... they should be params.logoTitle .

I'm not sure this is TOML syntax problem (https://toml.io/en/v1.0.0#table) Or Hugo TOML parser problem yet.

I fix this at https://github.com/xianmin/hugo-theme-jane/commit/baa2b23d3151037394c0737b29ea3baf98506621