本博客建站时间是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!
| Name | Description | Notes |
|---|---|---|
| title | * | string |
| linkTitle | * | string |
| subtitle | displayed below the title | string, 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 |
| hideInHomepage | hide this post in homepage posts list | boolean, valid for “posts” homepage with enableHideInHomepage enabled |
| languageCode | add lang attribute with this value to <article> | string |
| meta | set false to disable post-meta | boolean, override enablePostMeta in config.toml |
| displayPublishedDate | display published date in post-meta | boolean, override displayPublishedDate in config.toml |
| displayModifiedDate | display modified date in post-meta | boolean, override displayModifiedDate in config.toml |
| displayExpiryDate | display expiry date in post-meta | boolean, override displayExpiryDate in config.toml |
| displayCategory | display category in post-meta | boolean, override displayCategory in config.toml |
| displayWordCount | display word count in post-meta | boolean, override displayWordCount in config.toml |
| displayReadingTime | display reading time in post-meta | boolean, override displayReadingTime in config.toml |
| displayBusuanziPagePV | display page views in post-meta | boolean, override displayBusuanziPagePV in config.toml |
| toc | display TOC | boolean, override enableTOC in config.toml |
| tocNum | display TOC number | boolean, override displayTOCNum in config.toml |
| anchor | enable headings anchor | boolean, override enableHeadingsAnchor in config.toml |
| displayCopyright | display post-copyright | boolean, override displayPostCopyright in config.toml |
| badge | display updated-badge | boolean, override displayUpdatedBadge in config.toml |
| gitinfo | display post-gitinfo | boolean, override displayPostGitInfo in config.toml |
| share | display post-share | boolean, override displayPostShare in config.toml |
| related | display related-posts | boolean, override displayRelatedPosts in config.toml |
| katex | add KaTeX support | boolean, override enableKaTeX in config.toml |
| mathjax | add MathJax support | boolean, override enableMathJax in config.toml |
| mermaid | add Mermaid support | boolean, override enableMermaid in config.toml |
| comments | set false to disable comments in mainSections or set true to enable comments in non-mainSections | boolean |
| smallCaps | small caps? | boolean, override enableSmallCaps in config.toml |
| dropCap | drop cap? | boolean, override enableDropCap in config.toml |
| dropCapAfterHr | drop cap after every horizontal rule tag? | boolean, override enableDropCapAfterHr in config.toml |
| deleteHrBeforeDropCap | delete horizontal rule tag before drop cap? | boolean, override deleteHrBeforeDropCap in config.toml |
| indent | indent instead of margin? | boolean, override paragraphStyle in config.toml |
| indentFirstParagraph | indent the first paragraph? | boolean, override indentFirstParagraph in config.toml |
| align | normal, justify, center | string, if equal to “normal”, will override enableJustify in config.toml |
| original | original? You can add the following 8 terms if you set false. The author is required, other optional | boolean, override original in config.toml |
| author | author of original post | string |
| link | link of original post | string, URL |
| copyright | license of the post | string, Markdown supported |
| website | author’s website | string |
| author’s email | string | |
| motto | author’s description | string |
| avatar | author’s avatar | string, URL |
| author’s twitter id | string | |
| fediverse | author’s fediverse id | string |
| 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 |