目录

Hugo初试

安装

安装choco

1
2
Set-ExecutionPolicy Bypass -Scope Process
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

安装hugo

1
choco install hugo-extended -confirm

基本使用

创建新站

1
hugo new site hugo2

初始化git

1
2
cd hugo2
git init

安装主题Book

1
2
git submodule add https://github.com/alex-shpak/hugo-book themes/book
hugo server --minify --theme book

创建新文章

hugo new posts/hugo.md

启动服务器

hugo server -D

hugo-book主题开启KaTeX、Mermaid

1
2
3
4
# Needed for mermaid/katex shortcodes
[markup]
[markup.goldmark.renderer]
  unsafe = true

hugo-book启用中文搜索

1
2
3
4
5
6
7
languageCode = "cn"
defaultContentLanguage = 'cn'
[languages]
[languages.cn]
  languageName = 'Chinaese'
  contentDir = 'content'
  weight = 1