初始化 GitHub 仓库
初始化 Hugo
配置 PaperMod 主题
添加 RSS 订阅
参考这个链接的内容添加 RSS 订阅入口
支持 Disqus 评论
然后,在 Hugo 配置文件中增加如下内容:
params:
comments: true
services:
disqus:
shortname: your-disqus-shortname
最后,在 themes/PaperMod 的 layouts/partials/comments.html 中增加一行:
{{- /* Comments area start */ -}}
{{- /* to add comments read => https://gohugo.io/content-management/comments/ */ -}}
{{ template "_internal/disqus.html" . }} <!-- 这一行是新增的 -->
{{- /* Comments area end */ -}}
改进 AsciiDoc 支持
目前,Hugo 对 AsciiDoc 的支持还不是很完善,我们需要进行一些微调。
代码高亮
从 highlight.js 的官方网站获取到嵌入代码:



将两个链接插入 layouts/partials/extend_head.html 中:
{{- /* Head custom content area start */ -}}
{{- /* Insert any custom code (web-analytics, resources, etc.) - it will appear in the <head></head> section of every page. */ -}}
{{- /* Can be overwritten by partial with the same name in the global layouts. */ -}}
-- snippet --
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/<version>/styles/base16/<theme>.css" ... />
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/<version>/highlight.min.js"
onload="hljs.highlightAll()"> (1)
</script>
-- snippet --
{{- /* Head custom content area end */ -}}
1 | 在 highlight.js 提供的 HTML 的基础上增加 onload ,在加载 JavaScript 脚本之后对页面中所有代码块进行处理 |
扩展元素
美化
一般情况下,代码中中文和英文宽度不对齐,看着很难受,尤其是制作纯文本的表格时。可以用 Inconsolata 和 Noto Sans SC 配合实现对齐效果。

将 Google Fonts 提供的 HTML 插入到 layouts/partials/extend_head.html 中:
{{- /* Head custom content area start */ -}}
{{- /* Insert any custom code (web-analytics, resources, etc.) - it will appear in the <head></head> section of every page. */ -}}
{{- /* Can be overwritten by partial with the same name in the global layouts. */ -}}
-- snippet --
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inconsolata&family=Noto+Sans+SC:wght@100..900&display=swap" rel="stylesheet">
-- snippet --
{{- /* Head custom content area end */ -}}
第一篇博文
AsciiDoc 完全兼容 Markdown 的语法 |
---
title: "My First Blog Post"
---
== Section 1
```python
print("hello, world")
```