LoveIt
LoveIt copied to clipboard
[BUG] Adapt hugo 0.146
Describe the bug 描述你遇到的错误
Hugo reimplement template system in 0.146, and build failed with the new template system https://github.com/gohugoio/hugo/pull/13541
hugo v0.146.3-05ef8b713a3c091bfca7a3543ed016c64b3c6f88+extended linux/amd64 BuildDate=2025-04-12T17:21:50Z VendorInfo=gohugoio
Total in 54 ms
Error: error building site: html/template:_markup/render-codeblock-mermaid.html:[6](https://github.com/faimin/faimin.github.io/actions/runs/14448076537/job/40513552917#step:5:7):1[7](https://github.com/faimin/faimin.github.io/actions/runs/14448076537/job/40513552917#step:5:8): no such template "_default/_markup/render-codeblock.html"
Error: Process completed with exit code 1.
Expected behavior 期待的行为
build success
Screenshots 屏幕截图
Build Environment 构建环境
- OS: Ubuntu
- Theme commit [ c8b65127 ]
- Hugo version [ 0.146.3 ]
Please try to use Hugo extended version before opening the issue. 请在创建 issue 之前先尝试使用 Hugo extended 版本构建.
Preview Environment 预览环境
- OS: [macOS]
- Browser type/version [ Edge 135.0.3179.73 ]
Additional Information 补充信息
Configuration files or front matter code... 配置文件或者前置参数的代码...
i've been seeing variants on this pop up with the latest hugo builds as well. i haven't had a chance to really root cause what's going on here.
e.g.:
Error: html/template:_partials/internal/x.html:1:13: no such template "_internal/shortcodes/x.html"
i was able to work around these errors in the near term by creating overrides in $HUGO_DIR/layouts/partials/internal that remove the hugo.Version checks and only point at the _internal/... templates.
Same issue here
hugo version
hugo v0.147.0-7d0039b86ddd6397816cc3383cb0cfa481b15f32+extended linux/amd64 BuildDate=2025-04-25T15:26:28Z VendorInfo=gohugoio
hugo server
Error: html/template:_markup/render-codeblock-mermaid.html:6:17: no such template "_default/_markup/render-codeblock.html"
Same issue here
hugo version hugo v0.147.0-7d0039b86ddd6397816cc3383cb0cfa481b15f32+extended linux/amd64 BuildDate=2025-04-25T15:26:28Z VendorInfo=gohugoiohugo server Error: html/template:_markup/render-codeblock-mermaid.html:6:17: no such template "_default/_markup/render-codeblock.html"
Got the same error!
Got the same error on a fresh install.
i was able to work around these errors in the near term by creating overrides in
$HUGO_DIR/layouts/partials/internalthat remove thehugo.Versionchecks and only point at the_internal/...templates.
Could you share how you did that?
I just went and compiled an old version of hugo. I think it's the best workaround we have here.
Steps
- Uninstall
hugo - Make sure
gois installed and add go binaries into your PATH. In my case on Linux in~/.bashrc:
export PATH="$PATH:$HOME/go/bin"
- Install Hugo v0.145.0 (The last version LoveIt supports)
go install github.com/gohugoio/[email protected]
and enjoy till we can have a more up-to-date version of this cool theme.
there's a writeup at https://gohugo.io/templates/new-templatesystem-overview/ that outlines the changes that are necessary to make layouts resolution work in 0.146+.
i updated things to align with the new directory structure. along the lines of the following:
% tree --charset unicode layouts
layouts
|-- _default
|-- _partials
| |-- head
| | `-- link.html
| |-- internal
| | |-- x_simple.html # i stubbed this in
| | `-- x.html # ibid
| `-- single
| `-- footer.html
|-- _shortcodes
| |-- gfp.html
| |-- gist.html
| |-- mastodon.html
| `-- spotify.html
|-- index.jsonfeed.json
|-- links
| `-- single.html
|-- list.jsonfeed.json
|-- summary.html
`-- til
`-- single.html
this eliminated the build errors for me.
now i get the following warning. which i will deal with separately.
Start building sites …
hugo v0.147.3+extended+withdeploy darwin/arm64 BuildDate=2025-05-12T12:25:03Z VendorInfo=brew
WARN Current environment is "development". The "comment system", "CDN" and "fingerprint" will be disabled.
WARN 当前运行环境是 "development". "评论系统", "CDN" 和 "fingerprint" 不会启用.
WARN found no layout file for "html" for kind "term": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
| EN
-------------------+------
there's a writeup at https://gohugo.io/templates/new-templatesystem-overview/ that outlines the changes that are necessary to make layouts resolution work in 0.146+.
i updated things to align with the new directory structure. along the lines of the following:
% tree --charset unicode layouts layouts |-- _default |-- _partials | |-- head | | `-- link.html | |-- internal | | |-- x_simple.html # i stubbed this in | | `-- x.html # ibid | `-- single | `-- footer.html |-- _shortcodes | |-- gfp.html | |-- gist.html | |-- mastodon.html | `-- spotify.html |-- index.jsonfeed.json |-- links | `-- single.html |-- list.jsonfeed.json |-- summary.html `-- til `-- single.htmlthis eliminated the build errors for me.
now i get the following warning. which i will deal with separately.
Start building sites … hugo v0.147.3+extended+withdeploy darwin/arm64 BuildDate=2025-05-12T12:25:03Z VendorInfo=brew WARN Current environment is "development". The "comment system", "CDN" and "fingerprint" will be disabled. WARN 当前运行环境是 "development". "评论系统", "CDN" 和 "fingerprint" 不会启用. WARN found no layout file for "html" for kind "term": You should create a template file which matches Hugo Layouts Lookup Rules for this combination. | EN -------------------+------
Thank you :)
I've fixed this issue in my site with this commit. Feel free to check it for reference and see if it helps.
I've fixed this issue in my site with this commit. Feel free to check it for reference and see if it helps.
any chance you're opening a pull request to get these upstreamed? 😉
Can confirm sulrich's fork makes some things work again (MermaidJS code fences + hugo@latest).
The {{<mermaid>}} shortcode doesn't seem to work, using code fences does. Dark theme CSS is not ideal and could be improved for visibility (lines are dark gray on dark background, etc.).
- i forked this to address my needs specifically. if this gets resolved more broadly, i'll happily go back to whatever's upstream.
- i ripped out the mermaid bits from the current theme as it didn't seem to be consistently triggering the rendering at all. i adopted the fenced code approach a la the hugo docs. i've given zeero attention as to how to theme this for dark mode. creating a custom shortcode for this seems like the right move to ensure that this gets addressed.
given the significant filesystem restructuring that hugo imposes on things here, i think this really requires a new release to appropriately fix things. i don't know what the appetite for the maintainers is for addressing this.
For what little context I can give:
- this commit seems to do the same for LoveIt master (not part of 0.3.0): https://github.com/dillonzq/LoveIt/commit/859f5745116c0a750bbcb44146b5221145292d47
- the code blocks fenced with mermaid correctly render into a div
- https://github.com/dillonzq/LoveIt/blob/master/layouts/partials/assets.html#L130 is not triggering the JS include ending up in an
undefined mermaiderror - hugo 145-147 changed the api and deprecated
.Scratch.Get
Not a fan of {{<mermaid>}} but either way, same conclusion as yours @sulrich , it doesn't trigger rendering
export PATH="$PATH:$HOME/go/bin"
I solved it by this way.
I'm having the same issue with 0.146.0 hugo extend version. According to perplexity, that file should not be in the themes directory but in the /layouts. Will this be fixed soon?
I'm facing the same issue:
hugo server -D -M
WARN deprecated: the ":filename" permalink token was deprecated in Hugo 0.144.0 and will be removed in a future release. Use ":contentbasename" instead.
Error: html/template:_markup/render-codeblock-goat.html:6:17: no such template "_default/_markup/render-codeblock.html"
hugo version
hugo v0.148.1-98ba786f2f5dca0866f47ab79f394370bcb77d2f darwin/arm64 BuildDate=2025-07-11T12:56:21Z VendorInfo=gohugoio
I mitigate the issue differently. I create a local layouts/partials/shim.html (name of the file doesn't matter) with the following content:
{{ define "_default/_markup/render-codeblock.html" }}
{{- template "_markup/render-codeblock.html" . -}}
{{ end }}
{{ define "_internal/shortcodes/x.html" }}
{{- partial "shortcodes/x.html" . -}}
{{ end }}
{{ define "_internal/shortcodes/x_simple.html" }}
{{- partial "shortcodes/x_simple.html" . -}}
{{ end }}
{{ define "_internal/shortcodes/instagram.html" }}
{{- partial "shortcodes/instagram.html" . -}}
{{ end }}
I use trae.ai auto fixed loveit theme version . See this article. https://www.ffeeii.com/trae-solo-skill.html
I will update the patch soon to fix this problem, but need to ensure the compatibility of the old version first.
We need to make modifications to the config.toml configuration file so that it can support tags and categories.
config.toml
[Permalinks]
posts = ":contentbasename"
[taxonomies]
tag = "tags"
category = "categories"
cp layouts/taxonomy/list.html layouts/_default/term.html