我正在尝试使用 Hugo 创建一个网站,但我不知道如何向我的网站添加单个页面(帖子工作正常)。
从全新安装(v.0.27 64x for windows)开始并从我的终端运行以下命令:
> hugo new site soexample
> cd soexample
> git clone https://github.com/parsiya/Hugo-Octopress.git themes\octopress
> hugo new about.md
> echo "Please display me" >> content\about.md
> hugo serve -D -t octopress
我可以看到我的草稿页面是从最后一个命令的输出中呈现的:
...
Built site for language en:
1 of 1 draft rendered
...
但是当我尝试访问
http://localhost:1313/about/
或 http://localhost:1313/about.html
时,服务器(不是浏览器)返回一个白页:404 page not found
我错过了什么?
最佳答案
问题似乎来自所选的默认主题,该主题不会在帖子 single page 之外呈现 section 。对于初学者来说,主题可能是一个棘手的问题,因为 Hugo 未随附默认主题,并且不推荐或支持任何官方主题(因此初学者可能必须随机选择)。
所以以下命令对我有用:
> hugo new site soexample
> cd soexample
> git clone https://github.com/spf13/hyde.git themes\hyde
> hugo new about.md
> echo "Please display me" >> content\about.md
> hugo serve -D -t hyde
页面 http://localhost:1313/about/
已正确呈现。关于hugo - 为什么我在 Hugo 中的单个页面返回 404 HTTP 错误?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/46216333/