birdgg / hugo-theme-shoka

A hugo theme port from hexo theme shoka
https://birdgg.me
MIT License
9 stars 5 forks source link

在部署blog中遇到的兩個issus #6

Open LucasBlackLu opened 1 year ago

LucasBlackLu commented 1 year ago

在運行hugo server -D 出現兩個error,如下 [black@archlinux test]$ hugo server --disableFastRender Start building sites … hugo v0.109.0+extended linux/amd64 BuildDate=unknown Error: Error building site: failed to render pages: render of "section" failed: "/home/black/test/themes/hugo-theme-shoka/layouts/section/categories.html:2:5": execute of template failed: template: section/categories.html:2:5: executing "main" at <partial "pages/tree-sections.html" .>: error calling partial: "/home/black/test/themes/hugo-theme-shoka/layouts/partials/pages/tree-sections.html:8:42": execute of template failed: template: partials/pages/tree-sections.html:8:42: executing "partials/pages/tree-sections.html" at <len $pages>: error calling len: reflect: call of reflect.Value.Type on zero Value Built in 73 ms 將themes/hugo-theme-shoka/layouts/section/categories.html刪除後出現warnig hugo v0.109.0+extended linux/amd64 BuildDate=unknown WARN 2023/01/26 08:00:47 found no layout file for "JSON" for kind "home": You should create a template file which matches Hugo Layouts Lookup Rules for this combination,如上 在成功部署github action之後,主題無法正常顯示,我不知道是不是自己缺少關鍵步驟,現在正在用meme主題,真的很喜歡這個主題但我習慣用hugo,謝謝製作這個主題

LucasBlackLu commented 1 year ago

https://github.com/LucasBlacklu/website-hugo 這是我部署blog用的配置

birdgg commented 1 year ago

浏览器报了什么错误, clone 你的仓库后执行 hugo server --disableFastRender 可以正常显示

LucasBlackLu commented 1 year ago

很抱歉,应该是我阐述问题有误,在上面我是删除themes/hugo-theme-shoka/layouts/section/categories.html才可以从http://localhost:1313/预览网站; 如果没有删除这个themes/hugo-theme-shoka/layouts/section/categories.html文件, 就会提示这个报错 Change detected, rebuilding site. 2023-02-09 02:22:32.367 +0800 Template added CREATE "/home/black/website-hugo/themes/hugo-theme-shoka/layouts/section/categories.html" ERROR 2023/02/09 02:22:32 Rebuild failed: failed to render pages: render of "section" failed: "/home/black/website-hugo/themes/hugo-theme-shoka/layouts/section/categories.html:2:5": execute of template failed at <partial "pages/tree-sections.html" .>: error calling partial: "/home/black/website-hugo/themes/hugo-theme-shoka/layouts/partials/pages/tree-sections.html:8:42": execute of template failed at <len $pages>: error calling len: reflect: call of reflect.Value.Type on zero Value Total in 41 ms