I Built a Blog and Forgot to Write
I Built a Blog and Forgot to Write
我搭建了一个博客,却忘了写文章
Hello there! It’s been a while since I last wrote something 🙃. Part of it was just life getting busy, but I think a bigger factor was how hard I made it for myself to write anything. 你好!距离我上次写东西已经过去很久了 🙃。部分原因是生活变得忙碌,但我认为更重要的因素是我把写作这件事搞得太复杂了。
You see, as a proper engineer I had the most efficient personal blog. The content was written in markdown, made into a static site using 11ty, filled with custom scripts to process images and videos, custom CSS for fonts, nice clean templates and hand-crafted theme, and scripts to deploy everything with a single npm command. Well, it was perfect, minimalist, fast, very aesthetically pleasing for me (that is, the codebase). 你看,作为一个标准的工程师,我拥有一个最高效的个人博客。内容用 Markdown 编写,使用 11ty 生成静态网站,内置了处理图片和视频的自定义脚本、用于字体的自定义 CSS、简洁美观的模板和手工打造的主题,甚至还有一行 npm 命令就能部署一切的脚本。它确实完美、极简、快速,而且对我来说(指代码库)非常赏心悦目。
Except that I didn’t write anything. It was too hard. I had to make a new folder inside _content/ and then a .md file named the same as the parent folder (have you seen how ugly 5 index.md tabs look? not knowing what is what?). And then inside the markdown I had to add a front matter with a slug with the same name as the parent folder and filename. You can already see how stuck I felt doing even something as simple as changing the title of a post.
但问题是我什么都没写。这太难了。我必须在 _content/ 下新建一个文件夹,然后创建一个与父文件夹同名的 .md 文件(你见过 5 个 index.md 标签页并排在一起有多丑吗?根本分不清哪个是哪个)。接着,我必须在 Markdown 文件里添加 Front Matter,并设置一个与文件夹和文件名相同的 slug。你可以想象,连修改文章标题这样简单的事情都让我感到多么受阻。
But then came handling images or videos: how big are they? what is the correct ![image.png] to write? did I place images in the global /images folder or are they siblings with the post? Ugh! By the time I was done with all of that I had already forgotten what I wanted to write about.
更别提处理图片或视频了:它们多大?正确的 ![image.png] 语法怎么写?我是把图片放在全局的 /images 文件夹里,还是放在文章同级目录下?天哪!等我折腾完这些,我已经忘了自己想写什么了。
So then the issue was obviously 11ty. If only I had more control over how things work so that I could fine-tune everything exactly the way I wanted it… YES! I’ll build my own static site generator. How hard could it be!? (famous last words…) 所以,问题显然出在 11ty 上。如果我能对工作流程有更多控制权,就能按照我想要的方式微调一切……对了!我要自己写一个静态网站生成器。这能有多难!?(这是著名的“立 Flag”名言……)
So I did, or rather, so I started and never finished… I thought that a clean UNIX-philosophy static site generator would do: pandoc can convert markdown files to HTML, some bash scripts to iterate through my markdown files, inject some CSS and Bob’s your uncle. But wait. How do I make an index page listing all the article titles and dates and sort them? well I need to read the front matter for all the posts. But wait, how do I generate an RSS/Atom feed? maybe a template? I need the data from the front matter of the posts for this and a templating engine. How do I filter to exclude drafts? how do I serve? can I have hot reload? Yeah, how hard can it be! 于是我做了,或者说,我开始了但从未完成……我以为一个遵循 UNIX 哲学、简洁的静态网站生成器就够了:用 pandoc 把 Markdown 转成 HTML,写几个 bash 脚本遍历文件,注入一些 CSS,大功告成。但等等,我该怎么生成一个列出所有文章标题和日期并进行排序的索引页?我得读取所有文章的 Front Matter。那 RSS/Atom 订阅源怎么生成?用模板吗?我需要文章的元数据和一个模板引擎。怎么过滤掉草稿?怎么部署服务?能实现热重载吗?是啊,这能有多难!
But then I realized something: I was mixing up the process of building an efficient, performant, featureful blogging engine with the goal of writing posts! 🤦♂️ 但后来我意识到一件事:我把“构建一个高效、高性能、功能丰富的博客引擎”的过程,和“写文章”这个目标搞混了!🤦♂️
Process vs Results
过程 vs 结果
This might be obvious to some of you but it wasn’t for me until recently: in life there are things I care about the process and others that I care about the results, and mixing the two has caused me so much pain. 这对你们中的一些人来说可能显而易见,但我直到最近才意识到:生活中有些事情我关心的是过程,而另一些我关心的是结果,将两者混为一谈给我带来了巨大的痛苦。
Two examples, 3D printing and Linux. I got into 3D printing a few years ago. It was so fun to be able to imagine physical objects, see them on a screen and then have them as actual objects in the world. I printed so many useful things to organize my office, showcase my mechanical keyboards, hold the keys and paper towel, all kinds of cool things. But then, as a proper tinkerer, I wanted more control over my 3D printer. So I swapped out the main board, flashed a custom firmware, connected a Raspberry Pi to it, added a webcam, tweaked the motors and added some extra sensors… but completely lost my interest in 3D printing… 举两个例子:3D 打印和 Linux。几年前我开始接触 3D 打印。能够构思出实体物体,在屏幕上看到它们,然后让它们成为现实世界中的实物,这太有趣了。我打印了许多实用的东西来整理办公室、展示机械键盘、放置钥匙和纸巾,各种酷炫的东西。但后来,作为一个典型的折腾党,我想要对 3D 打印机有更多控制权。于是我更换了主板,刷了自定义固件,连接了树莓派,加了摄像头,调整了电机,还加了额外的传感器……结果我彻底失去了对 3D 打印的兴趣……
You see, 3D printing became so hard: what was that local DNS I assigned to the 3D printer RPI? what nozzle does it have at the moment? is the RPI even on? the local website of the custom firmware is not responding, the filament is not sticking, did I run that bed leveling thing and copy/pasted the values into the calibration thing? The whole thing went from putting an SD card in the 3D printer and printing, to a whole bunch of steps because of all the control I had. Sure, my 3D printer was arguably more powerful, but at the cost of so much more complexity. And I’ve now realized that regarding 3D printing, I couldn’t care less about the process. I just want the prints. 你看,3D 打印变得太难了:我给树莓派分配的本地 DNS 是什么?现在用的是哪个喷嘴?树莓派开机了吗?自定义固件的本地网页没响应,耗材粘不住,我运行那个床面调平程序了吗?我把数值复制粘贴到校准工具里了吗?整个过程从“插上 SD 卡就能打印”变成了“因为拥有了过多的控制权而产生的一堆繁琐步骤”。当然,我的 3D 打印机确实更强大了,但代价是复杂性剧增。现在我意识到,对于 3D 打印,我根本不在乎过程,我只想要打印出来的成品。
With Linux the story was a bit similar. I’ve used Arch since forever. It is an awesome distro where all the newest OSS software lands first. You can customize it to your heart’s content, to the point of knowing exactly how many processes are running after boot, having a full working system with like 400MB of RAM usage, and having your own rice with everything just perfect, precisely pixel perfect. That was fun and all until I had to do something productive with my computer! Then the custom stuff just became friction. X needed some service running to share screen, and Y didn’t work with a tiling window manager. I also needed to add a script to launch Z because my custom launcher didn’t recognize the .desktop files the program came with… I installed Fedora and everything just worked. It was awesome. Again I had confused wanting the process vs wanting the results.
Linux 的故事也差不多。我一直用 Arch Linux。这是一个很棒的发行版,所有最新的开源软件都会第一时间登陆这里。你可以随心所欲地定制它,精确到知道开机后运行了多少个进程,拥有一个内存占用仅 400MB 左右的完整工作系统,并把一切调教得完美无缺、像素级精准。这很有趣,直到我需要用电脑做点正事!这时,那些定制化反而成了阻碍。X 需要运行某个服务才能共享屏幕,Y 在平铺式窗口管理器下无法工作。我还得写个脚本来启动 Z,因为我的自定义启动器识别不了程序自带的 .desktop 文件……后来我安装了 Fedora,一切都直接能用。这太棒了。我又一次混淆了“想要过程”和“想要结果”。
I think there’s more nuance to it, but as a tinkerer/maker/engineer/hacker/what have you, I’m used to enjoying the process: building the thing, knowing how things work under the hood, being in full control and the power understanding it entails, realizing a vision, overcoming difficulties, learning new things and bending the computer/device/situation to my will. All of that is great, but when embarking on something new, knowing if I’m embarking on it for the process/journey or for the results has been saving me some headaches lately. 我想这其中还有更微妙的地方,但作为一个折腾者/创客/工程师/黑客,我习惯于享受过程:构建事物、了解底层原理、拥有完全的控制权以及由此带来的掌控感、实现愿景、克服困难、学习新知识并让计算机/设备/环境按我的意愿运行。这一切都很棒,但当开始做新事情时,明确自己是为了过程/旅程还是为了结果,最近确实帮我省去了不少麻烦。
As an example, I’m currently picking up Linear Algebra. The journey is arduous but I’m doing this for the results. I need this to better understand Statistical Learning. On the other hand, I’m also learning Real Analysis. It could be useful someday, but I’m doing it because I love the journey. Analysis is beautiful and elegant, infinite series are weird and mysterious (Fourier series are straight up wizardry!), Euler was an absolute genius, the landscapes are gorgeous, and I’m in it for the journey! 举个例子,我最近在学线性代数。过程很艰苦,但我为了结果而学,因为我需要它来更好地理解统计学习。另一方面,我也在学实分析。它将来可能有用,但我学它是因为我热爱这个过程。分析学优美而优雅,无穷级数既怪异又神秘(傅里叶级数简直是魔法!),欧拉绝对是天才,其中的风景美不胜收,我沉浸在这一旅程中!
Concessions
让步
So then, here I am actually writing! This blog is still by any measure nerdy and opinionated, it is 所以,我终于开始写了!这个博客无论从哪个角度看依然很极客、很有个人风格,它……