enpitsulin

enpitsulin

这个人很懒,没有留下什么🤡
twitter
github
bilibili
nintendo switch
mastodon

Article content migrated from Sanity.io - The Journey of a Blog

In about who knows how many versions ago probably when I was still using Next.js, the content of my articles was migrated from a local file to this CMS called Sanity.io.

Sanity.io is actually great, but why did I migrate back now? Here, I want to talk about the journey of blog development.

Hexo Static Site#

From the beginning of building a blog, I didn't choose the traditional web page construction method like Wordpress. One reason is that having a server is quite troublesome and prone to attacks. Another reason is that I prefer a more geeky approach, so I chose a statically generated blog.

Actually, if you look back at my past articles, you can find that I initially used Hexo, and during this period, some of the earlier articles were lost 😥. Hexo is actually a very perfect static blog program. It has almost all the necessary features and a very good community environment.

But the problem is that for me, as a developer, the architecture of Hexo is basically composed of traditional templates + CSS + JavaScript. After I entered the workforce, this kind of architecture is no longer in demand even if I learn it through tinkering. Web development is gradually being replaced by frameworks like Vue and React, especially Vue, which is both new and old and is very popular in China.

So the blog moved towards a statically generated framework based on React. As for why it's not Vue, first of all, the Vue-based blog programs at that time were not good enough, and I mainly worked with Vue at work, so I wasn't interested in using Vue in my spare time.

Note: Now it seems that using tools like Nuxt.js and Vitepress to build a blog is already very good and can be considered as an option.

Embracing React#

The Amazing Gatsby#

At first, I came across Gatsby, which is a relatively well-established website development framework. It can be said that using it to develop a static blog is like using a sledgehammer to crack a nut. However, I didn't save the source code at that time, which is a bit regrettable. It was the first project I practiced after mastering React.

But after using it for a while, I felt that Gatsby was too heavy for a small blogrelated article. At that time, my GitHub repository received strange dependency warnings, so I switched to Next.js.

But using Gatsby introduced me to a new knowledge, which is GraphQL. All the data in the blog (such as articles) is queried through GraphQL, which expanded my horizons beyond the basic exposure to Restful and JSONrpc at that time. This part of the experience was quite good.

Who is Next?#

After going around, I came to the king of the React ecosystem - Next.js. As a framework based on React, it also provides the ability of SSG. In fact, I only learned about SSG\SSR\CSR after using Gatsby.

During this period, the blog also moved to Vercel. Previously, it was based on GitHub Pages, and I also briefly tried using GitHub Actions provided by GitHub for simple continuous integration of my blog.

As the top player in the React ecosystem, Next.js can be said to have no shortcomings. You can see from the source code that in the later stages, the blog has moved from local markdown files to content hosted on Sanity.io, which required some effort to use remote content while still having a complete MDX experience. There was also a period of time when I wanted to use Notion as a CMS, but the effect was not good, so I came to Sanity.io.

During this period, based on the improvement of my React skills, I gradually realized that React does have some cognitive burden, and there are also some architectural flaws in Next.js. The page system based on single files gradually confused the Node.js environment and the web environment. Next.js 13 brought App Router, which to some extent solved this problem, which is great

So I briefly switched to vite-plugin-ssr.

Speed is the Key#

During the time of using Next.js, Vite emerged, and I was very envious because webpack is indeed slow, and developing plugins is also troublesome. So I made a tough decision to switch to using vite-plugin-ssr to build my blog.

To be honest, it was a bit troublesome at first, and I realized that a lot of work had been done by a behind-the-scenes SSR framework. It really made me cry

So I spent some time using vite-plugin-ssr to recreate the blog from Next.js. The experience was actually quite good. Personally, I think both DX and UX are top-notch. But then I encountered astro.

The Space Age#

With the development of frontend, there are more and more dazzling frameworks like remix\Qwik\astro, which bring isolated architecture and are said to be very powerful.

I also followed the trend and came to astro. In fact, I had already come into contact with it when astro was not yet at version 1.0, but I officially migrated the blog to astro when [email protected] was released.

The feeling astro gives me is a return to simplicity, just like the experience of directly writing HTML+CSS+JavaScript. A large part of the functionality is implemented through writing native JavaScript code, but the development experience it brings is very modern, based on Vite and with excellent TypeScript support. This gives me a feeling of both new and old.

Moreover, it can integrate with various UI frameworks such as Vue, Solid, and React, which is quite impressive. I think astro can be considered as a thin veil for all the previous solutions, both in terms of DX and UX.

During this time, I also learned about Solid and added it as a UI framework to my blog. It doesn't have the cognitive burden of React in terms of responsive implementation, and I really think that compilation is indispensable in the frontend field. Sacrificing a small part of DX for performance improvement is actually quite good.

But I really don't understand memo and useCallback, after all, I don't have much exposure to React in my work, so I prefer to learn something that is not so difficult in my spare time 😥. Maybe I should find a company that uses React

Migration of Article Content#

Actually, it's because remote markdown content cannot have a complete MDX experience, or I choose to sacrifice runtime 0JS, and astro indeed provides a much better integration of content.

And if I use Sanity.io, the workflow for writing articles becomes more complicated. As a geeky solution, based on Git is not that bad. Let the articles follow the repository through push/pull from now on.

Moving towards Web3#

Actually, recently I came across xLog, which is a blockchain-based blog. I highly recommend it to friends who have writing needs and want to step into Web3 as their first application, especially those who are not familiar with blog tinkering.

Actually, forget about the theories about Web3 that are full of hype. Blockchain technology is indeed the most primitive form of an open and free internet in my opinion - decentralized, without censorship, and based on consensus.

Although it is also filled with human nature and brings a lot of malicious behavior, it may be attractive to people who want a certain environment and simply need an uncensored writing platform.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.