Skip to content

Fix Hugo 0.160+ compatibility (deprecated site.Author, partial context in render hooks)#12

Open
splusq wants to merge 1 commit into
michenriksen:mainfrom
splusq:fix/hugo-0.160-compat
Open

Fix Hugo 0.160+ compatibility (deprecated site.Author, partial context in render hooks)#12
splusq wants to merge 1 commit into
michenriksen:mainfrom
splusq:fix/hugo-0.160-compat

Conversation

@splusq

@splusq splusq commented Apr 27, 2026

Copy link
Copy Markdown

Summary

The theme currently fails to build with Hugo v0.156+ due to two breaking changes upstream:

  1. site.Author / .Site.Author was removed. The example site already configures the author under [params.author], so the templates should read site.Params.author (with a small guard so the head.html <meta name=\"author\"> tag falls back to the name field when the value is a map).
  2. Bare partial \"svg/...\" calls fail inside render hooks. In Hugo 0.160 a partial call with no second argument no longer inherits a usable context inside e.g. render-heading, so the SVG partials' .class | default ... expression errors with can't evaluate field class in type string. Passing an explicit (dict) context restores the previous behavior.

Fixed files:

  • layouts/partials/head.htmlsite.Authorsite.Params.author (+ map fallback)
  • layouts/404.html.Site.Author.emailsite.Params.author.email
  • layouts/_default/_markup/render-heading.html
  • layouts/_default/_markup/render-codeblock.html
  • layouts/_default/_markup/render-codeblock-mermaid.html
  • layouts/posts/list.html, layouts/notes/list.html
  • layouts/partials/page/meta.html, layouts/partials/footer.html

Test plan

  • hugo builds clean against hugo v0.160.1+extended with example-style [params.author] config
  • Maintainer to confirm against minimum supported Hugo version (currently 0.134.2 in CI)

🤖 Generated with Claude Code

- Replace deprecated `site.Author` / `.Site.Author` with `site.Params.author`
  in head.html and 404.html. Author block now read from `[params.author]`,
  matching the example site's configuration.
- Pass explicit `(dict)` context to all `partial "svg/..."` calls. In Hugo
  0.160 a bare `partial NAME` no longer inherits a usable context inside
  render hooks (e.g. render-heading), causing `.class` lookups in svg
  partials to fail with "can't evaluate field class in type string".

Tested against Hugo v0.160.1+extended.
@TheWeightOf

Copy link
Copy Markdown

@michenriksen please help review?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants