First blog post!

With just a few days left in the semester, I scrambled to tinker with my blog right before New Year’s, and figured I’d do a year-end summary along the way. (?)

Year-end summary?

I’ve never really felt much about these activities based around regular time intervals, like birthdays, New Year’s, or other holidays/anniversaries. To me, they are merely a piling up of time; reaching these time points doesn’t bring any practical changes. However, turning 18 was slightly different. At least in China, I was no longer subject to gaming anti-addiction restrictions, and I could do many things on my own. Looking back now, 18 is already quite far away from me…

If I were to use one word to summarize the past year, it would be “lost”. Even though I know a few programming languages and have explored some frameworks, during my few years in college, I haven’t implemented a single project of my own, which is quite sad. I hope that after making this blog, I can do some real development.

I am a lazybones

Actually, I’ve had the idea of building a blog for a long time, but due to various reasons (like being lazy, lazy, and lazy again), I procrastinated until this year’s New Year to finally make it happen.

I did consider using things like Hexo to set it up quickly and directly, but I’ve already seen so many “friends” using Hexo (if you’ll allow me to call them that?). I wanted to do something different. At the same time, I had a heretical idea of mapping file paths to a database (similar to Next.js’s file-system based router, though if I actually made it a database, performance would probably be terrible due to small file I/O). However, due to the complexity of implementing it, I gave up on this idea.

During the summer vacation, I learned a bit of Rust. I originally wanted to use Rust for the backend or even full-stack development, but later I realized I simply wasn’t up to it XD, nor did I have much time to mess around with it. The biggest problem during the process of building the blog was probably the frontend. The UI, in particular, gave me a massive headache. I didn’t want the same theme templates as everyone else, but I also couldn’t design one myself. Ultimately, I pretty much ended up using a template anyway.

Performance Worship

I have always had a bit of “performance worship” when it comes to programming languages, technologies, and frameworks. In the past, when I used devices with terrible performance, there were clearly lightweight software options providing the same functions, yet some other software was so bloated and laggy that it was unusable.

I once held some contempt for things like Node.js because of its performance issues and npm’s bloat (which I saw others complaining about). Looking back, such thoughts were incredibly naive. Although some problems still exist, there’s really no need to put one thing on a pedestal and step on another. Technology serves to solve problems, and any technology that can solve a problem is a good technology.

Attempts to Learn Frontend Development

I once tried to learn Vue, but after reading the official documentation, I was still completely lost. I tried to set up a baseURL using axios in Vue and mount the created axios object onto the global $. (241124 edit: I saw many people doing this before. Now that I am slightly more familiar with Vue, looking back, it’s quite baffling—Vue 3 almost never does this and there’s no need to, though quite a few people did it in Vue 2). After following online tutorials and docs and still failing, I gave up on Vue.

About half a month before New Year’s Day, I had some free time and read Frontend Engineering: Design and Practice Based on Vue.js 3.0. After understanding a bit about “Why use frontend frameworks?”, I tried to learn React (Next.js) again. (? Wait, isn’t this book about Vue ?)

Here, I want to praise the interactive tutorial for Next.js: Start building with Next.js. Almost every step in the tutorial explains why you should do it that way and what problem it solves. Each chapter has some quizzes (which you can definitely answer if you’ve read the article), and the answers deepen your understanding of the chapter. I knew almost nothing about the frontend, but after reading it, I really learned a lot. It reminded me of some Vue documentation I had read before, which almost exclusively talked about syntax and use cases. Now I really hate tutorials or courses on languages/technologies that only teach syntax and APIs. That kind of stuff should just be documentation for you to look up when needed; at least for me, I forget it as soon as it’s taught.

Time to Hack Something Together!

With about ten days left until New Year’s Day, I made up my mind to finish the blog before the end of the year, or at the very least, before the Spring Festival.

My idea was to simply map the Markdown files in a directory and lightly handle pagination and searching.

When learning Rust, I came across Deno. Initially, I tried to build the blog with Fresh as a full-stack framework. Going full-stack with JavaScript was also meant to save time, and I started learning Tailwind CSS. But when it came to implementing page components and a navigation component with client-side navigation instead of full-page loads, I didn’t know how to do it. It seemed I couldn’t find relevant resources online either. I immediately decided to give up. I immediately decided to switch to a more mature framework. Fresh wasn’t something I could handle, but I did learn a bit of JSX along the way, so I quickly pivoted to Next.js.

After the basic framework and pages were set up, I was just a step away from replacing the page components with rendered Markdown. However, due to errors caused by dangerouslySetInnerHTML and a few other details when using the markdown-it library, and after my attempts at “Search Engine Oriented Programming” (isn’t that what I always do?) proved fruitless, I lost it XD.

In the comment section of a certain blog, I saw the Astro framework recommended for content management. After looking into it briefly, I found it seemed to solve some of the pain points of Next.js handling Markdown, so I gave it a try. During my time trying Astro, apart from my own broken English, there were basically no obstacles. This thing is genuinely convenient, providing a lot of out-of-the-box content management features.

Astro v4 uses remark by default to render Markdown and shiki for code block syntax highlighting. Customizing the theme for this thing… looks like a huge hassle. While I was looking for a remark plugin to copy code blocks, I came across Nextra, but I had lost all interest in switching frameworks again.

In the end, I managed to cobble this thing together. I’ll try out themes and internationalization support later when I have time.