【笔记】部署Hugo博客

前言

部署Hugo博客

下载依赖

1
go install github.com/gohugoio/hugo@latest

创建项目

blog:项目名

1
2
hugo new site <project_name>
cd <project_name>

配置主题

  • 本文以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目录存放静态文件

完成

参考文献

Hugo官方文档
哔哩哔哩——CodeSheep
gohugoio/hugo