mivinci / hugo-theme-minima

A clean and minimal Hugo theme.
https://mivinci.github.io/hugo-theme-minima
MIT License
132 stars 37 forks source link

换完主题,启动报错 #10

Closed xbot closed 2 years ago

xbot commented 2 years ago
❯ 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
mivinci commented 2 years ago

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

xbot commented 2 years ago

是的:

❯ hugo version hugo v0.89.4+extended darwin/amd64 BuildDate=unknown

On Nov 28, 2021, at 15:12, XJJ @.***> wrote:

@xbot https://github.com/xbot 你用的是 hugo 扩展版吗(hugo-extended)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Mivinci/hugo-theme-minima/issues/10#issuecomment-980863714, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIEZ2P765VPUSYLYOO27GTUOHI7JANCNFSM5I47EF5A.

xbot commented 2 years ago

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

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

mivinci commented 2 years ago

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

xbot commented 2 years ago

好的,谢谢。

On Nov 28, 2021, at 15:54, XJJ @.***> wrote:

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

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Mivinci/hugo-theme-minima/issues/10#issuecomment-980938765, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIEZ2IIXEUPJOORG3P5OODUOHNZVANCNFSM5I47EF5A.