1.首先安装 Hugo,在不同系统上安装都很简单,在 Mac 上,使用 Homebrew 安装 Hugo: brew install hugo 等待安装即可
2.建立博客站点 安装以后,首先我们需要建立一个博客目录,下面存放的是博客的所有配置以及博文等资料,例如要建立一个名为 Blog 的站点,使用下面的命令:hugo new site Blog
Congratulations! Your new Hugo site is created in /Users/jdhao/Blog. Just a few more steps and you're ready to go: 1. Download a theme into the same-named folder. Choose a theme from https://themes.gohugo.io/, or create your own with the “hugo new theme ” command. 2. Perhaps you want to add some content. You can add single files with “hugo new /.”. 3. Start the built-in live server via “hugo server”. Visit https://gohugo.io/ for quickstart guide and full documentation.
➜ Blog git:(master) ✗ hugo server -D Building sites … ERROR 2020/01/04 15:08:40
There are two possible situations that led to this error: 1. You haven't copied the config.toml yet. See https://github.com/olOwOlo/hugo-theme-even#installation 2. You have an incompatible update. See https://github.com/olOwOlo/hugo-theme-even/blob/master/CHANGELOG.md#400-2018-11-06
Built in 38 ms Watching for changes in /Users/seven/Blog/{archetypes,content,data,layouts,static,themes} Watching for config changes in /Users/seven/Blog/config.toml Environment: "development" 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
报错生成页面错误: 1,原因是front matter不符合规范 render of "page" failed
➜ Blog git:(master) ✗ hugo server ERROR 2020/01/04 15:40:34 render of "page" failed: execute of template failed: template: post/single.html:14:5: executing "post/single.html" at <partial "head.html" .>: error calling partial: "/Users/seven/Blog/themes/even/layouts/partials/head.html:22:82": execute of template failed: template: _internal/schema.html:22:82: executing "_internal/schema.html" at <.Params.tags>: range can't iterate over CDH ERROR 2020/01/04 15:40:34 render of "page" failed: execute of template failed: template: post/single.html:14:5: executing "post/single.html" at <partial "head.html" .>: error calling partial: "/Users/seven/Blog/themes/even/layouts/partials/head.html:22:82": execute of template failed: template: _internal/schema.html:22:82: executing "_internal/schema.html" at <.Params.tags>: range can't iterate over flume ERROR 2020/01/04 15:40:34 render of "page" failed: execute of template failed: template: post/single.html:14:5: executing "post/single.html" at <partial "head.html" .>: error calling partial: "/Users/seven/Blog/themes/even/layouts/partials/head.html:22:82": execute of template failed: template: _internal/schema.html:22:82: executing "_internal/schema.html" at <.Params.tags>: range can't iterate over 123456 Built in 26 ms Error: Error building site: failed to render pages: render of "page" failed: execute of template failed: template: post/single.html:14:5: executing "post/single.html" at <partial "head.html" .>: error calling partial: "/Users/seven/Blog/themes/even/layouts/partials/head.html:22:82": execute of template failed: template: _internal/schema.html:22:82: executing "_internal/schema.html" at <.Params.tags>: range can't iterate over CDH,sentry
2.Front matter tag:[],中括号前面没有空格导致错误
failed to unmarshal YAML: yaml: line 5: could not find expected ':'