博客改造

博客建站时间是2023年7月7日,当时还是个自动化boy,对于web知识基本没有。整个博客的搭建过程全靠主题作者的使用文档。初版比较粗糙,主打一个能用就行,由于没有详细的使用文档,所以刚开始所有的图片都是绝对路径引用,非常草台。

在2025年年末,我完成了毕业答辩闲了下来,这时候萌生重构博客的想法。同时期间我更换了笔记本,这时候需要迁移老的文件到新的电脑上,我采用了远古时代的u盘拷贝来同步两台电脑的博客数据,十分不优雅。种种因素吧,年后忙完了毕业申请等等事宜后,我着手博客的重新改造。

博客目前的几个痛点: 1、图片问题,现在我所有的图片都是使用的push到github上的绝对路径,非常麻烦。 2、项目代码与项目构建产物的管理问题,项目代码需要同步,可是当时没有使用github建立仓库来统一管理。 3、主题更新、hugo更新旧语法不兼容问题。

对于痛点1,我重新阅读了hugo的文档,使用相对路径改造,在/static目录下新建/images文件夹,文章所有地方都采用编译后的相对路径。

对于痛点2,新建github项目管理项目代码,通过GitHub Actions实现推送流水线,在推送后自动编译静态文件。

对于痛点3,通过github子模块来实现主题的更新。语法兼容问题由CodeX大人帮忙解决。生在ai时代的幸福。

架构图◎ github-actions github真大善人

下面记录一些操作备忘操作。

新建博客

hugo new "life/hello-world.md"

主题更新命令

git submodule update --remote --merge

Front Matter

Click to expand!
NameDescriptionNotes
title*string
linkTitle*string
subtitledisplayed below the titlestring, Markdown supported
date*string
lastmod*string
publishDate*string
expiryDate*string
<taxonomies> eg: categories, tags, series*array
description*string, Markdown supported
summary*string, Markdown supported
images*array
slug*string
url*string
draft*boolean
isCJKLanguage*boolean
weight*integer
type*string, if equal to “poetry”, will use a special layout for it
layout*string
outputs*array
aliases*array
markup*string
hideInHomepagehide this post in homepage posts listboolean, valid for “posts” homepage with enableHideInHomepage enabled
languageCodeadd lang attribute with this value to <article>string
metaset false to disable post-metaboolean, override enablePostMeta in config.toml
displayPublishedDatedisplay published date in post-metaboolean, override displayPublishedDate in config.toml
displayModifiedDatedisplay modified date in post-metaboolean, override displayModifiedDate in config.toml
displayExpiryDatedisplay expiry date in post-metaboolean, override displayExpiryDate in config.toml
displayCategorydisplay category in post-metaboolean, override displayCategory in config.toml
displayWordCountdisplay word count in post-metaboolean, override displayWordCount in config.toml
displayReadingTimedisplay reading time in post-metaboolean, override displayReadingTime in config.toml
displayBusuanziPagePVdisplay page views in post-metaboolean, override displayBusuanziPagePV in config.toml
tocdisplay TOCboolean, override enableTOC in config.toml
tocNumdisplay TOC numberboolean, override displayTOCNum in config.toml
anchorenable headings anchorboolean, override enableHeadingsAnchor in config.toml
displayCopyrightdisplay post-copyrightboolean, override displayPostCopyright in config.toml
badgedisplay updated-badgeboolean, override displayUpdatedBadge in config.toml
gitinfodisplay post-gitinfoboolean, override displayPostGitInfo in config.toml
sharedisplay post-shareboolean, override displayPostShare in config.toml
relateddisplay related-postsboolean, override displayRelatedPosts in config.toml
katexadd KaTeX supportboolean, override enableKaTeX in config.toml
mathjaxadd MathJax supportboolean, override enableMathJax in config.toml
mermaidadd Mermaid supportboolean, override enableMermaid in config.toml
commentsset false to disable comments in mainSections or set true to enable comments in non-mainSectionsboolean
smallCapssmall caps?boolean, override enableSmallCaps in config.toml
dropCapdrop cap?boolean, override enableDropCap in config.toml
dropCapAfterHrdrop cap after every horizontal rule tag?boolean, override enableDropCapAfterHr in config.toml
deleteHrBeforeDropCapdelete horizontal rule tag before drop cap?boolean, override deleteHrBeforeDropCap in config.toml
indentindent instead of margin?boolean, override paragraphStyle in config.toml
indentFirstParagraphindent the first paragraph?boolean, override indentFirstParagraph in config.toml
alignnormal, justify, centerstring, if equal to “normal”, will override enableJustify in config.toml
originaloriginal? You can add the following 8 terms if you set false. The author is required, other optionalboolean, override original in config.toml
authorauthor of original poststring
linklink of original poststring, URL
copyrightlicense of the poststring, Markdown supported
websiteauthor’s websitestring
emailauthor’s emailstring
mottoauthor’s descriptionstring
avatarauthor’s avatarstring, URL
twitterauthor’s twitter idstring
fediverseauthor’s fediverse idstring
disqus_url*string, if not set, will use Permalink as default
disqus_identifier*string, if not set, will use RelPermalink as default
disqus_title*string, if not set, will use Title as default
updatedupdated2026-03-082026-03-08