【笔记】部署Hugo博客
前言
部署Hugo博客
准备工作
- Git
下载脚手架
Go
1 | go install github.com/gohugoio/hugo@latest |
MacOS
1 | brew install hugo |
初始化
blog
:站点目录名
1 | hugo new site blog |
配置主题
- 本文以
ananke
主题为例
1 | git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke |
配置文件中指定主题
1 | echo "theme = 'ananke'" >> hugo.toml |
创建文章
file.md
:文章文件
1 | hugo new posts/file.md |
- 会在
content
下创建posts
目录,并在posts
目录下创建.md
文件
启动服务
--theme=<theme>
、-t <theme>
:指定主题--config=<config_file>
:指定配置文件
1 | hugo server |
生成静态文件
1 | hugo |
- 生成完成后会生成
public
目录存放静态文件