安装:
1
2
3
4
5
6
7
8
9
10
| ➜ ~ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.4 LTS
Release: 20.04
Codename: focal
➜ ~ arch
x86_64
➜ ~ go version
go version go1.18.3 linux/amd64
|
1
| sudo apt-get install hugo
|
或者 直接下载bin文件,然后解压到/usr/local/bin
1
| sudo tar -zxvf /mnt/d/Ubuntu/hugo_extended_0.101.0_Linux-64bit.tar.gz -C /usr/local/bin
|
- 查看版本(注意:非extended版本不支持编译scss)
1
2
| ➜ ~ hugo version
hugo v0.101.0-466fa43c16709b4483689930a4f9ac8add5c9f66+extended linux/amd64 BuildDate=2022-06-16T07:09:16Z VendorInfo=gohugoio
|
生成网站
来个主题
我选的是even主题
1
2
3
4
5
6
| cd my_blog
git clone https://github.com/olOwOlo/hugo-theme-even themes/even
rm -rf themes/even/.git
mv themes/even/exampleSite/content/* content/
mv themes/even/exampleSite/config.toml ./
hugo server --theme=even --buildDrafts -D
|
打开 http://localhost:1313/
可参考文档进行配置config.toml
启动本地服务可能会有警告
1
2
| # google_news internal template should be deprecated...
https://github.com/gohugoio/hugo/issues/9172
|
- 可以删除掉themes\even\layouts\partials\head.html中的下面代码:
1
| {{- template "_internal/google_news.html" . -}}
|