参考:快速入门 | Hugo 中文网
环境准备
安装hugo
brew install hugo
问题1
1
2
3
| Cloning into '/Users/agq/Library/Caches/Homebrew/hugo--git'...
fatal: unable to access 'https://github.com/gohugoio/hugo.git/': Recv failure: Operation timed out
|
解决方法:关闭代理
问题2
1
2
3
| Cloning into '/Users/agq/Library/Caches/Homebrew/hugo--git'...
fatal: unable to access 'https://github.com/gohugoio/hugo.git/': Failed to connect to github.com port 443 after 75008 ms: Couldn't connect to server
|
配置代理
1
2
3
4
5
| git config --global http.proxy 127.0.0.1:7890
git config --global https.proxy 127.0.0.1:7890
git config --global http.proxy socks5 127.0.0.1:7890
git config --global https.proxy socks5 127.0.0.1:7890
|
问题3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
| Error: Your Command Line Tools (CLT) does not support macOS 14.
It is either outdated or was modified.
Please update your Command Line Tools (CLT) or delete it if no updates are available.
Update them from Software Update in System Settings.
If that doesn't show you any updates, run:
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
Alternatively, manually download them from:
https://developer.apple.com/download/all/.
You should download the Command Line Tools for Xcode 14.3.
|
解决方法:根据提示运行命令即可
1
2
3
4
5
| sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
brew update-reset
|
安装git
brew install git
本地静态博客搭建
创建新站点
`hugo new site quickstart
配置主题
1
2
3
| cd quickstart
git init
git submodule add https://github.com/budparr/gohugo-theme-ananke.git themes/ananke
|
然后,将主题添加到站点的配置文件中:
1
| echo 'theme = "ananke"' >> config.toml
|
然后启动,在 http://localhost:1313/ 进行本地查看
这里容易出现一个错误,就是hugo.toml
的theme没有设置,导致出现PageNotFound。
以上是hugo的基本安装教程。
配置本地静态页面
找来找去,本来想用academy来做学术主页,结果又要实名认证,略有些麻烦,于是换上了stack。
具体可以看GitHub - CaiJimmy/hugo-theme-stack: Card-style Hugo theme designed for bloggers
细节就不赘述了,终于是配置好了,最后是目前的成品。
AGA’s Blog
其他功能
图床配置
打开图床配置 | PicX在线使用
配置参考快速开始 | PicX 图床使用指南
obsidian导出 markdown
1
| obsidian-export /Users/agq/Documents/obsidian/源文件/ /Users/agq/Documents/obsidian/目的文件夹/
|
评论配置
参考Site Unreachable