基础说明
简单记录Hugo搭建博客过程,详细功能在Hugo官方文档 查看
创建站点
创建一个hugo-blog项目
F:\hugoSite>hugo new project hugo-blog
Congratulations! Your new Hugo project was created in F:\hugoSite\hugo-blog.
Just a few more steps...
1. Change the current directory to F:\hugoSite\hugo-blog.
2. Create or install a theme:
- Create a new theme with the command "hugo new theme <THEMENAME>"
- Or, install a theme from https://themes.gohugo.io/
3. Edit hugo.toml, setting the "theme" property to the theme name.
4. Create new content with the command "hugo new content <SECTIONNAME>\<FILENAME>.<FORMAT>".
5. Start the embedded web server with the command "hugo server --buildDrafts".
See documentation at https://gohugo.io/.创建结果如下

引入主题
在Hugo官方主题库 挑选主题。这里选hugp-theme-kami 。
有两种导入方式
As a Hugo Module:需要本地安装go,懒得搞….
As a git submodule:
git init初始化hugo-blog- 执行
git submodule add https://github.com/mackt/hugo-theme-kami.git themes/hugo-theme-kami - 在根目录
hugo.toml增加一行theme = "hugo-theme-kami"
实际操作
我用了更懒的方法:主要是用git submodule的话在github action时还要再拉一遍,我就直接固定主题版本了
- 在/the\mes里直接clone项目
git clone https://github.com/mackt/hugo-theme-kami.git,然后把.git删掉 - 在根目录
hugo.toml增加一行theme = "hugo-theme-kami"
主题配置
按文档里的操作方式来,我是直接把\themes\hugo-theme-kami\exampleSite下的config和content直接复制到项目根目录下

运行
cmd执行hugo server就执行了
F:\hugoSite\hugo-blog>hugo server
Watching for changes in F:/hugoSite/hugo-blog/archetypes, F:/hugoSite/hugo-blog/assets, F:/hugoSite/hugo-blog/content/posts, F:/hugoSite/hugo-blog/data, F:/hugoSite/hugo-blog/i18n, F:/hugoSite/hugo-blog/layouts, F:/hugoSite/hugo-blog/static, F:/hugoSite/hugo-blog/themes/hugo-theme-kami/assets/{css,js}, F:/hugoSite/hugo-blog/themes/hugo-theme-kami/i18n, F:/hugoSite/hugo-blog/themes/hugo-theme-kami/layouts/{_markup,_partials,page}, ... and 1 more
Watching for config changes in F:\hugoSite\hugo-blog\hugo.toml, F:\hugoSite\hugo-blog\config\_default
Start building sites …
hugo v0.171.0-e665d9eef946c8e6cd67356efff6013a3bb750b7 windows/amd64 BuildDate=2026-11-30T14:21:35Z VendorInfo=gohugoio
│ EN
──────────────────┼────
Pages │ 21
Paginator pages │ 0
Non-page files │ 0
Static files │ 3
Processed images │ 0
Aliases │ 0
Cleaned │ 0
Built in 52 ms
Environment: "development"
Serving pages from disk
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访问http://localhost:1313/就可以了