博客配置

参考:快速入门 | Hugo 中文网

环境准备

安装hugo

brew install hugo

问题1

1Cloning into '/Users/agq/Library/Caches/Homebrew/hugo--git'...
2
3fatal: unable to access 'https://github.com/gohugoio/hugo.git/': Recv failure: Operation timed out

解决方法:关闭代理

问题2

1Cloning into '/Users/agq/Library/Caches/Homebrew/hugo--git'...
2
3fatal: 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

配置代理

1git config --global http.proxy  127.0.0.1:7890
2git config --global https.proxy  127.0.0.1:7890
3
4git config --global http.proxy socks5 127.0.0.1:7890
5git config --global https.proxy socks5 127.0.0.1:7890

问题3

 1Error: Your Command Line Tools (CLT) does not support macOS 14.
 2
 3It is either outdated or was modified.
 4
 5Please update your Command Line Tools (CLT) or delete it if no updates are available.
 6
 7Update them from Software Update in System Settings.
 8
 9  
10
11If that doesn't show you any updates, run:
12
13  sudo rm -rf /Library/Developer/CommandLineTools
14
15  sudo xcode-select --install
16
17  
18
19Alternatively, manually download them from:
20
21  https://developer.apple.com/download/all/.
22
23You should download the Command Line Tools for Xcode 14.3.

解决方法:根据提示运行命令即可

1  sudo rm -rf /Library/Developer/CommandLineTools
2
3  sudo xcode-select --install
4
5  brew update-reset

安装git

brew install git

本地静态博客搭建

创建新站点 `hugo new site quickstart

配置主题

1cd quickstart 
2git init 
3git submodule add https://github.com/budparr/gohugo-theme-ananke.git themes/ananke

然后,将主题添加到站点的配置文件中:

1echo 'theme = "ananke"' >> config.toml

然后启动,在 http://localhost:1313/ 进行本地查看

1hugo server -D

这里容易出现一个错误,就是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

1obsidian-export /Users/agq/Documents/obsidian/源文件/ /Users/agq/Documents/obsidian/目的文件夹/

评论配置

参考Site Unreachable

Licensed under CC BY-NC-SA 4.0