Theme Switching Commemoration and Some Thoughts
纪念
2023年1月24日晚上,三天前。
终于下决心把博客从以前的旧主题hexo-theme-matery切换成现在使用的hexo-theme-fluid。
不过也由于各种奇怪的问题,磨磨蹭蹭拖了两三天才弄完,至少解决了大部分问题。
旧的主题因为我当时使用的时候功能不多,我自己在自己的分支上添加了很多功能,修改了很多文件,结果更新的时候合并出一大堆问题,版本控制彻底爆炸。再加上没注释,很多东西我自己都不知道是啥。。
大部分是因为我之前在添加代码的时候完全没想到后续更新,然后随意添加代码,删改文件。然后git记录里面乱成一片,自己都不知道自己干什么。。
想法和记录
在切换主题的时候,最大问题是hexo最近版本新引入的一个功能,覆盖主题设置,就是_config.<theme.name>.yml。
之前按照fluid docs 覆盖配置来配置,但是搞了一天多一直不生效,但是我又不想直接去修改theme下的_config,所以一直搞不定,结果一天之后突发奇想把_config.fluid.yml名字改成_config.hexo-theme-fluid.yml,结果就成功了…
不得不说切换主题之后,加载速度快多了,而且Lighthouse评分也高多了。效果真的很显著,而且比以前看起来差不多。
以前的主题太注重各种好看的功能,加载了大量js和css,结果加载速度挺慢的,现在fluid在效果和加载速度中取得了不错的平衡。
Commemoration
On the evening of January 24, 2023, three days ago.
I finally made up my mind to switch the blog’s theme from the old hexo-theme-matery to the currently used hexo-theme-fluid.
However, due to various strange issues, it dragged on for two or three days before I finished, having at least solved most of the problems.
The old theme had few features when I originally used it, so I added many functions and modified numerous files on my own branch. As a result, merging updates created a heap of issues, and version control completely blew up. Combined with the lack of comments, I myself didn’t even remember what a lot of the code was for.
Mostly because I never considered future updates when adding code earlier, and I just inserted code and changed files arbitrarily. Then, the git history became a complete mess, and I didn’t even know what I had done.
Thoughts and Notes
While switching themes, the biggest issue was a feature recently introduced in newer versions of Hexo: overriding theme settings via _config.<theme.name>.yml.
Initially, I configured it according to fluid docs overriding configuration. But after struggling for over a day without it taking effect, and not wanting to directly modify the _config under the theme directory, I was stuck. Then, a day later, on a whim, I renamed _config.fluid.yml to _config.hexo-theme-fluid.yml, and it just worked…
I must say, after switching themes, the loading speed is much faster, and the Lighthouse score is also significantly higher. The improvement is really noticeable, and the look is about the same as before.
The previous theme focused too much on various fancy features, loading a massive amount of JS and CSS, which resulted in quite slow loading speeds. Now fluid has struck a good balance between effects and loading speed.