Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hugo server时遇到问题 #1

Closed
Reqwey opened this issue Sep 5, 2020 · 8 comments
Closed

hugo server时遇到问题 #1

Reqwey opened this issue Sep 5, 2020 · 8 comments
Assignees

Comments

@Reqwey
Copy link

Reqwey commented Sep 5, 2020

我Clone了这个主题以后,hugo server 遇到了如下的问题,而换用hugo默认主题ananke则成功部署,请问我应该怎么解决

linhk@ubuntu:~/文档/quickstart$ hugo server
Building sites … WARN 2020/09/05 22:33:01 found no layout file for "HTML" for kind "taxonomyTerm": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2020/09/05 22:33:01 found no layout file for "HTML" for kind "taxonomyTerm": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
Built in 36 ms
Error: Error building site: failed to render pages: render of "home" failed: execute of template failed: template: index.html:8:11: executing "index.html" at <partial "footer/script.html" .>: error calling partial: "/home/linhk/文档/quickstart/themes/stack/layouts/partials/footer/script.html:5:43": execute of template failed: template: partials/footer/script.html:5:43: executing "partials/footer/script.html" at <js>: can't evaluate field Build in type string

根目录下的config.toml

baseURL = "http://example.org/"
languageCode = "en-us"
title = "My New Hugo Site"
theme = "stack"
@CaiJimmy
Copy link
Owner

CaiJimmy commented Sep 5, 2020

请参考 exampleSite 文件夹下的配置

https://github.com/CaiJimmy/hugo-theme-stack/blob/master/exampleSite/config.toml

@Reqwey
Copy link
Author

Reqwey commented Sep 6, 2020

emm...好像还是会报这个错,顺便问下,根目录的config.toml和主题里的theme.toml有什么关系?好像有些东西既可以在前一个里面定义,又可以在后一个里面写

@Reqwey
Copy link
Author

Reqwey commented Sep 6, 2020

hugo version为

Hugo Static Site Generator v0.68.3/extended linux/amd64 BuildDate: 2020-03-25T06:15:45Z

hugo server -D为

Building sites … WARN 2020/09/06 10:20:23 found no layout file for "HTML" for kind "section": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2020/09/06 10:20:23 found no layout file for "HTML" for kind "taxonomyTerm": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2020/09/06 10:20:23 found no layout file for "HTML" for kind "taxonomyTerm": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
ERROR 2020/09/06 10:20:23 render of "home" failed: execute of template failed: template: index.html:4:7: executing "main" at <partialCached "sidebar/left.html" .>: error calling partialCached: "/home/linhk/文档/oi.lhkstudio.me/themes/stack/layouts/partials/sidebar/left.html:12:44": execute of template failed: template: partials/sidebar/left.html:12:44: executing "partials/sidebar/left.html" at <$avatar.Resize>: nil pointer evaluating resource.Resource.Resize
Total in 34 ms
Error: Error building site: failed to render pages: render of "page" failed: execute of template failed: template: _default/single.html:4:7: executing "main" at <partial "sidebar/left.html" .>: error calling partial: "/home/linhk/文档/oi.lhkstudio.me/themes/stack/layouts/partials/sidebar/left.html:12:44": execute of template failed: template: partials/sidebar/left.html:12:44: executing "partials/sidebar/left.html" at <$avatar.Resize>: nil pointer evaluating resource.Resource.Resize

@Reqwey
Copy link
Author

Reqwey commented Sep 6, 2020

@CaiJimmy
Copy link
Owner

CaiJimmy commented Sep 6, 2020

主题要求 Hugo 最低版本为 0.74:https://github.com/CaiJimmy/hugo-theme-stack#requirements

你指出的报错不是 Bug,是因为 assets 文件夹下找不到 config.toml 指定的 img/avatar.png。 需要在站点根目录下创建 assets/img/avatar.png。同样,这一点可以参考 exampleSite 文件夹,或者也可以直接把该文件夹下的内容复制到你站点的根目录。

通过该文件夹编译出的站点:https://hugo-theme-stack.netlify.app/

@CaiJimmy CaiJimmy self-assigned this Sep 6, 2020
@Reqwey
Copy link
Author

Reqwey commented Sep 6, 2020

哦,感谢大佬指点,那么现在的问题就是,我的ubuntu20.04的软件源下到hugo的最新版本就是0.68.3,我得想法去换个源

@CaiJimmy
Copy link
Owner

CaiJimmy commented Sep 6, 2020

哦,感谢大佬指点,那么现在的问题就是,我的ubuntu20.04的软件源下到hugo的最新版本就是0.68.3,我得想法去换个源

Snap 有最新版本:https://snapcraft.io/hugo

或者可以直接去 Hugo 的 Release 页面下载编译好的文件

@CaiJimmy CaiJimmy closed this as completed Sep 8, 2020
@Reqwey
Copy link
Author

Reqwey commented Sep 8, 2020

谢谢,最近因为开学了有点忙,所以没有来得及测试,现在已经解决了😁

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

No branches or pull requests

2 participants