我目前正在尝试在本地构建一个 Hugo 网站,但没有显示任何内容。我希望有更多的故障排除步骤或任何可以帮助我进行干净重建的东西,这样我就不必将所有帖子转移到 Google 网站。
我尝试重新实例化站点,使用 hugo
重建它,使用 hugo server
和 hugo server -D
启动服务器,但我只得到一个空白屏幕。
我的页面不是草稿,所以肯定应该显示一些内容。公共或索引文件夹可能被搞砸了,但我不确定。
hugo version
: Hugo Static Site Generator v0.48/extended darwin/amd64
go version
: go version go1.11.2 darwin/amd64
config.toml
:
baseURL = ""
languageCode = "en-us"
title = ""
theme = "ananke"
[menu]
[[menu.main]]
identifier = "Posts"
name = "Posts"
pre = "<i class='fa fa-road'></i>"
url = "/posts/"
weight = -100
[params]
featured_image = "images/space-cat-wallpaper.jpg"
twitter = ""
使用 hugo
构建页面时:
| EN
+------------------+----+
Pages | 72
Paginator pages | 0
Non-page files | 0
Static files | 21
Processed images | 0
Aliases | 1
Sitemaps | 1
Cleaned | 0
Total in 88 ms
使用 hugo server -D
启动本地实例时:
| EN
+------------------+-----+
Pages | 117
Paginator pages | 5
Non-page files | 0
Static files | 21
Processed images | 0
Aliases | 1
Sitemaps | 1
Cleaned | 0
Total in 120 ms
Watching for changes in /Users/jschalz/Desktop/hugo-jschalz.github.io-2/{content,data,layouts,static,themes}
Watching for config changes in /Users/jschalz/Desktop/hugo-jschalz.github.io-2/config.toml
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop
运行hugo -v --debug -D
后,我收到以下警告,然后是很多调试噪音:
WARN 2019/06/16 16:33:21 No translation bundle found for default language "en"
WARN 2019/06/16 16:33:21 Translation func for language en not found, use default.
WARN 2019/06/16 16:33:21 i18n not initialized, check that you have language file (in i18n) that matches the site language or the default language.
导航到 localhost:1313 给我一个空白屏幕。
第一个hugo -v --debug -D
可以告诉你更多
其次,要真正确定生成了一些东西,请尝试:
hugo server --renderToDisk --gc --cleanDestinationDir
检查文件是否已创建(而不是在内存中提供(
注意:我总是喜欢添加我的config.toml
builddrafts = true
它在启动项目时很有用,以确保生成所有内容。
OP ladygremlin在评论中证实:
我认为
config.toml
中的builddrafts = true
修复了它!
我还升级到了最新版本的雨果。