mivinci/hugo-theme-minima

换完主题,启动报错

Closed this issue · 5 comments

xbot commented
❯ hugo server -D
Building sites … ERROR 2021/11/28 15:00:22 render of "page" failed: execute of template failed: template: _default/single.html:5:5: executing "_default/single.html" at <partial "header.html" .>: error calling partial: "/Users/donie/Projects/blog/themes/minima/layouts/partials/header.html:6:64": execute of template failed: template: partials/header.html:6:64: executing "partials/header.html" at <index .Site.Params.switch 1>: error calling index: index of untyped nil
ERROR 2021/11/28 15:00:22 render of "page" failed: execute of template failed: template: _default/single.html:5:5: executing "_default/single.html" at <partial "header.html" .>: error calling partial: "/Users/donie/Projects/blog/themes/minima/layouts/partials/header.html:6:64": execute of template failed: template: partials/header.html:6:64: executing "partials/header.html" at <index .Site.Params.switch 1>: error calling index: index of untyped nil
ERROR 2021/11/28 15:00:22 render of "page" failed: execute of template failed: template: _default/single.html:5:5: executing "_default/single.html" at <partial "header.html" .>: error calling partial: "/Users/donie/Projects/blog/themes/minima/layouts/partials/header.html:6:64": execute of template failed: template: partials/header.html:6:64: executing "partials/header.html" at <index .Site.Params.switch 1>: error calling index: index of untyped nil
ERROR 2021/11/28 15:00:22 render of "page" failed: execute of template failed: template: _default/single.html:5:5: executing "_default/single.html" at <partial "header.html" .>: error calling partial: "/Users/donie/Projects/blog/themes/minima/layouts/partials/header.html:6:64": execute of template failed: template: partials/header.html:6:64: executing "partials/header.html" at <index .Site.Params.switch 1>: error calling index: index of untyped nil
ERROR 2021/11/28 15:00:22 EXECUTE-AS-TEMPLATE: failed to transform "minima.1638082822.js" (application/javascript): template: minima.1638082822.js:1:18: executing "minima.1638082822.js" at <index .Site.Params.switch 1>: error calling index: index of untyped nil
ERROR 2021/11/28 15:00:22 failed to render pages: render of "page" failed: execute of template failed: template: _default/single.html:5:5: executing "_default/single.html" at <partial "header.html" .>: error calling partial: "/Users/donie/Projects/blog/themes/minima/layouts/partials/header.html:6:64": execute of template failed: template: partials/header.html:6:64: executing "partials/header.html" at <index .Site.Params.switch 1>: error calling index: index of untyped nil
Built in 618 ms
Error: Error building site: EXECUTE-AS-TEMPLATE: failed to transform "minima.1638082821.js" (application/javascript): template: minima.1638082821.js:1:18: executing "minima.1638082821.js" at <index .Site.Params.switch 1>: error calling index: index of untyped nil

@xbot 你用的是 hugo 扩展版吗(hugo-extended)

xbot commented
xbot commented

我是在原来的配置文件里把 theme 改成 minima 之后出的问题,把配置文件整个替换成 exampleSite 下的之后可以正常启动,我将继续尝试修改各项设置成我的值,如果没有问题,就是之前的不完全配置导致的。理论上讲,如果只替换主题,也应该可以正常运行,但我不确定这个健壮性是应该由 hugo 负责还是主题作者来实现。

抱歉浪费你的时间了,我先把 ticket 关了。

@xbot 不同主题的配置字段不太可能相同(除了 Hugo 提供的公共部分),因为不同主题提供的的功能和自定义的程度不相同。Hugo 的机制是换主题就应该把配置文件换成使用的主题的配置文件,然后在使用的主题的配置文件上进行更改,这点和 Hexo 那种主题配置和博客配置分离的设计不一样。

xbot commented