惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V2EX - 技术
V2EX - 技术
P
Privacy International News Feed
Security Latest
Security Latest
H
Hacker News: Front Page
T
Tenable Blog
The Hacker News
The Hacker News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
S
Security @ Cisco Blogs
Project Zero
Project Zero
O
OpenAI News
AI
AI
Spread Privacy
Spread Privacy
C
CERT Recently Published Vulnerability Notes
The Last Watchdog
The Last Watchdog
G
GRAHAM CLULEY
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Scott Helme
Scott Helme
Application and Cybersecurity Blog
Application and Cybersecurity Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
C
CXSECURITY Database RSS Feed - CXSecurity.com
NISL@THU
NISL@THU
A
Arctic Wolf
T
Threat Research - Cisco Blogs
PCI Perspectives
PCI Perspectives
N
News and Events Feed by Topic
C
Cyber Attacks, Cyber Crime and Cyber Security
C
Cybersecurity and Infrastructure Security Agency CISA
Simon Willison's Weblog
Simon Willison's Weblog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Know Your Adversary
Know Your Adversary
Google Online Security Blog
Google Online Security Blog
罗磊的独立博客
L
LINUX DO - 最新话题
U
Unit 42
S
Security Affairs
有赞技术团队
有赞技术团队
WordPress大学
WordPress大学
博客园 - 【当耐特】
T
The Exploit Database - CXSecurity.com
S
Schneier on Security
月光博客
月光博客
Engineering at Meta
Engineering at Meta
腾讯CDC
F
Full Disclosure
Cyberwarzone
Cyberwarzone
S
SegmentFault 最新的问题
Recorded Future
Recorded Future
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
博客园 - 司徒正美
The Cloudflare Blog

齐物 on 老刘博客

Arch Linux 电源优化指南 Ubuntu 26.04 用了一个月 告别 PaperMod:审美疲劳后的 Hugo 博客“换装”记 Ubuntu25.10编译安装Ibus-libpinyin 博客托管平台换成edgeone pages 博客评论换回Giscus EndeavourOS + Btrfs + Snapper + GRUB:完整的快照回滚系统配置指南 把GotoSocial嵌入到Hugo 群晖NAS安装FRP客户端(frpc) Ubuntu24.04安装Windterm 从 Windows 到 Linux:重新体验的过程与心得 解决腾讯 EdgeOne 域名解析与 SSL 证书申请失败问题 折腾杀毒软件的一点感想 开箱|媳妇的华为 Watch Fit 4 Ghost 博客与 Mailgun 邮件服务申请全流程 Ubuntu部署ghost博客所踩的小坑 当GitHub二次验证丢失:我的完整恢复经历 在群晖里安装简单的笔记软件flatnotes 手机上有好用的输入法吗? 再次使用 KeepassXC进行密码管理 解决Windows11打开安全中心空白的方法 修汽车空调 给Hugo PaperMod增加giscus评论系统 2024年,高德地图和百度地图选哪个? 电视和投影仪,哪个对孩子的眼睛更好? 使用Fcitx5 for Android,读《万历十五年》 2024年 Web 开发趋势 利用cloudflare页面规则设置301永久跳转 初冬时节话镜片防雾 在群晖中使用tailscale实现内网穿透 EndeavourOS安装之后的几件事 Hugo-papermod主题的优化记录 视光周刊(第9期):年轻的时候近视,年老不花眼? 从WordPress转到Hugo 思源笔记群晖正确的部署方法 近视人群夏季佩戴太阳镜的几种方案 在manjaro中安装使用Rime并启用雾凇输入法 开始试用小狼毫输入法 使用群晖自动备份网站 manjaro安装配置fcitx5输入法 没有公网IP也能玩转群晖DDNS ubuntu20.10升级编译安装ibus-libpinyin输入法 电波表如何接收日本电波对时塔的信号 奇葩的京东无线宝 keepass加群辉实现数据同步及浏览器自动填充密码(二) zerotier加openwrt路由实现内网穿透控制群晖 打造一个安全的宝塔面板服务器环境 网易词典笔2.0简单开箱 给鱼缸上了沼泽过滤 破磨边机,早晚换了你 Apple iPad第七代使用小计 使用群晖,配置打印机,实现无线打印机的功能 宝塔面板安装FRP内网穿透控制群晖 推荐一款免费的视频剪辑软件shotcut 使用zerotier进行内网穿透 再次折腾黑群晖系统 记暴风酷播云2期折腾黑群晖 WordPress开启Nginx fastcgi_cache缓存加速 lnmp一键开启waf及使用 Fail2Ban防护 给7B2主题加上外链自动跳转功能 这次发现百度收录的挺快的 百度输入法小测 黑莓8830上网利器之浏览器 做博客比做网站难 网站又搬家了—这次选的衡天小张的服务器 换到pipni的空间了 杯具,原来上传的图片等都没有能转过来 换了个模板 小测三款博客离线编辑软件 开发出godaddy免费空间的另外一个用途 体验了下失而复得 解决godaddy免费空间广告带来影响的方法 小测QQ刚推出的webqq mini wordpress中文tag、中文分类找不到文章的解决方法 提供WordPress 主题 Marcelle的汉化版本 博客整体细节基本完成 虚惊一场 如何增加WordPress上传文件类型 ubuntu9.10 sis显卡驱动程序 聪明的宝宝 lnkillprocess.exe – DLL 初始化失败终极解决方案 lnkillprocess.exe-dll初始化失败的原因终于找到了 如何安全使用计算机4 如何安全使用计算机 3 如何安全使用计算机 2 如何安全使用计算机 1 KPI考评——企业绩效管理的基础 推荐大家使用Symantec Endpoint Protection 11.0.4000_MR4简体中文正式版
给Hugo PaperMod主题添加一个漂亮又简洁的友情链接页面
老刘 · 2025-10-13 · via 齐物 on 老刘博客

PaperMod 默认是极简风格,没有自带“友情链接(Friends / Links)”页,但是我们博主也不是互联网的孤岛,总有一些自己喜欢的左邻右舍,最简单的方法是用生成一个页面来作为友情链接页面,但是太丑了。老刘结合chatgpt,自己添加一个漂亮的友情链接页面,下面是 详细教程(以 Hugo + PaperMod 为例):

一、创建友情链接页面

在你的 Hugo 项目根目录执行:

1
hugo new friends/_index.md

这会在 content/friends/_index.md 生成文件。 打开该文件,修改为:

1
2
3
4
5
---
title: "友情链接"
layout: "friends"
summary: "那些值得一去的好地方"
---

( 注意: layout 是我们下一步要创建的模板文件名。)

二、创建页面模板

PaperMod 的页面模板位于:

1
themes/PaperMod/layouts/

但我们不直接改主题文件(避免主题升级覆盖),而是复制到你的项目中:

1
mkdir -p layouts/_default

然后创建一个新模板文件:

1
nano layouts/_default/friends.html

写入以下示例模板(简洁、与 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
{{ define "main" }}
<main class="main-content" id="main-content">
  <article class="post-single">
    <header class="post-header">
     

      <h1 class="post-title">{{ .Title }}</h1>
      {{ with .Params.summary }}
        <p class="post-description">{{ . }}</p>
      {{ end }}
    </header>
<style>
.friend-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.2rem;
  margin-top: 1.5rem;
}
.friend-card {
  display: flex;
  align-items: center;
  padding: 1rem;
  border-radius: 0.75rem;
  background: var(--entry);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: all 0.25s ease;
}
.friend-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}
.friend-card img {
  width: 3rem;
  height: 3rem;
  border-radius: 9999px;
  margin-right: 1rem;
}
.friend-card .text-gray-600 {
  color: var(--secondary);
}
</style>

    <div class="post-content">
      {{ .Content }}

      <div class="friend-links grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4 mt-6">
        {{ range .Site.Data.friends }}
          <a href="{{ .url }}" target="_blank" rel="noopener" class="friend-card flex items-center p-4 rounded-xl shadow-sm hover:shadow-md transition">
            <img src="{{ .avatar }}" alt="{{ .name }}" class="w-12 h-12 rounded-full mr-4">
            <div>
              <div class="font-semibold">{{ .name }}</div>
              <div class="text-sm text-gray-600">{{ .desc }}</div>
            </div>
          </a>
        {{ end }}
      </div>
    </div>
  </article>
</main>
{{ end }}

三、创建数据文件(友情链接信息)

在项目根目录新建:

添加如下内容(你可以随意扩展):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
- name: "PaperMod 官方"
  url: "https://github.com/adityatelange/hugo-PaperMod"
  avatar: "https://avatars.githubusercontent.com/u/21258296?v=4"
  desc: "简洁优雅的 Hugo 主题"

- name: "Hugo 官网"
  url: "https://gohugo.io/"
  avatar: "https://gohugo.io/images/hugo-logo-wide.svg"
  desc: "世界上最快的静态网站生成器"

- name: "老刘博客"
  url: "https://iliu.org/"
  avatar: "https://iliu.org/img/apple-touch-icon.png/"
  desc: "分享我的思考与生活"

四、将“友情链接”加入导航栏

打开 config.yml 或 config.toml(根据你使用的格式),找到菜单配置部分:

1
2
3
4
5
6
menu:
  main:
    - identifier: friends
      name: 友情链接
      url: /friends/
      weight: 30

五、重新生成并预览

打开浏览器访问:

1
http://localhost:1313/friends/

即可看到一个简洁、卡片式的友情链接页面,与 PaperMod 风格一致。 具体风格可以参考: 老刘博客

通过以上步骤,你就成功地为 Hugo PaperMod 主题添加了一个既美观又简洁的友情链接页面。这个页面不仅能增强你的站点互通性,还能提升用户体验。如果你喜欢,也可以根据自己的需求对样式和布局进行进一步的调整和优化。希望这篇文章对你有所帮助!