体验hugo主题hugo-PaperMod

体验hugo主题hugo-PaperMod

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# windows下执行
winget install Hugo.Hugo.Extended

# 创建hugo模块
hugo mod init github.com/ynhugo/ynhugo.github.io
hugo mod get -u

# windows下执行
go env -w GOPROXY=https://goproxy.cn
go install github.com/mikefarah/yq/v4@latest
# termux下执行
pkg install -y yq

# 获取官方主题配置文件
mv hugo.toml hugo.toml_bak
curl -x 127.0.0.1:10808 -sLO https://raw.githubusercontent.com/adityatelange/hugo-PaperMod/refs/heads/exampleSite/config.yml
# 转换主题配置文件
yq -p yaml -o toml config.yml > hugo.toml

# 修改主题配置文件
sed -i "/^theme/d" hugo.toml
tee -a hugo.toml > /dev/null << 'END'
[[module.imports]]
path = "github.com/adityatelange/hugo-PaperMod"
END

# 添加about页面
tee content/about.md > /dev/null << 'END'
---
title: "About"
date: 2026-05-09T12:00:00+05:30
description: "A fast, clean, and responsive Hugo theme designed for bloggers and content creators."
author: ["Aditya Telange"]
draft: false
hiddenInRss: true
disableShare: true
ShowBreadcrumbs: false
---

PaperMod is a fast, clean, and responsive Hugo theme designed for bloggers and content creators. It offers a modern design with a focus on readability and performance, making it an excellent choice for personal blogs, portfolios, and documentation sites.
END

# 添加archives页面
tee content/archives.md > /dev/null << 'END'
---
title: "Archive"
layout: "archives"
# url: "/archives"
summary: "archives"
---
END

# 添加search页面
tee content/search.md > /dev/null << 'END'
---
title: "Search"
placeholder: Search demo site with full text fuzzy search ...
layout: "search"
---
END

hugo server -D --bind 0.0.0.0 -p 1313

# 如果不想使用hugo-PaperMod了,可以删掉该主题
hugo mod tidy      # 从 go.mod / go.sum 移除未使用的依赖
hugo mod clean     # 删除下载的主题缓存(释放磁盘空间)

对比hugo-theme-stack

stack的搜索效果比PaperMod舒服,PaperMod官方配置搜索关键词时只会列出相关文章,不显示文章下引用到部分内容,并且不能通过链接搜索关键词,而stack以上都可以做到,当然我使用PaperMod搜索体验不好也可能是因为我初体验PaperMod没有很好的配置该主题,留待后话。

参考链接

Hugo PaperMod

https://github.com/adityatelange/hugo-PaperMod/wiki/Installation

https://github.com/adityatelange/hugo-PaperMod/tree/exampleSite/content

解决 go install 第三方包, 连接代理网址 proxy.golang.org 超时

https://transform.tools/yaml-to-toml

使用 Hugo 构建
主题 StackJimmy 设计