Moving from Wordpress to Astro


Moving from Wordpress to Astro

Hello, Astro!

I moved from WordPress to Astro. To be honest, I wasn’t unhappy with WordPress. I was just thinking, “It’s too slow!” or “Security is not good! I didn’t feel any of the disadvantages that are often said to be “slow” or “insecure” for a personal blog. But, on the other hand, I didn’t find any reason why “WordPress is the only way”.

When I started creating websites, more than 20 years ago, content was created directly in HTML and uploaded directly to the server via FTP. People were writing and publishing diaries that no one thought would ever be read. Magical i-Land” took the world by storm. Speaking of dynamic sites, it was common to create a bulletin board using Perl and post it on your own site. This may have been influenced by “2channel. Later, the word “blog” was coined, which was derived from “WebLog” (logging on the Web) and “Blog. The appearance of CMSs such as Movable type and WordPress made it possible to write articles on the Web, categorize them, tag them, and then let the viewer extract information as he/she likes. If you write articles on the web, categorize them, tag them, etc., then you can create a user-friendly site where visitors can extract information as they like. It also became popular because you could subscribe to RSS feeds of your favorite sites and get information quickly, and you could easily connect with people around you through comments and trackbacks. I started using Wordpress on that wave and have been using it for more than 20 years now.

Since then, social networking services such as Mixi, Facebook, Twitter, Instagram, YouTube, and TikTok have emerged, and blogs are no longer a tool for connecting with others, but merely a medium for disseminating information. Comments and commentary on articles are also social networking sites. You can put a share button on an article. In fact, it is better for the article to be diffused. In this situation, it has become important to write articles that are easily searchable, in other words, how to do SEO. A decade ago, there were sterile SEO wars over how to earn links and how to include meta information, but now that Google has become more sophisticated, writing quality articles has become an SEO measure, and we can say that we are finally getting to the point where SEO is what it should be. In this case, it is no longer important whether the site is dynamic or static. It is important to write quality articles and build a site with fast display speed. That is what is important.

With various other backgrounds, the era is Jamstack. Static Site Generator (SSG) is one part of it, and I have tried Jekyll, Pelican, Hugo, Gatsby, etc. You can easily create development documentation using Docusaurus, mdBook, MkDocs, etc. Just push to GitHub. I can push to GitHub and deploy automatically with GitHub Actions. Creating static sites is also much smarter than it used to be.

I have thought several times about migrating my personal blog, which has been running for many years, to a static site. I had no particular dissatisfaction with Wordpress, as I mentioned above, and the trouble of extracting information from the database and re-creating articles in Markdown was more troublesome, so I did not proceed with the move. However, for some reason, I decided to take the plunge this time. The articles I had accumulated were getting old and no longer valuable, so I thought it would be a good idea to start again from this point. I can gradually migrate the old articles that are still necessary. I came to this feeling because I was under a lot of stress and wanted to change something for a fresh start.

At first I used Gatsby to rebuild my blog, because Gatsby is a popular static site generator and I like React myself. After all, Gatsby sounds kind of cool. However, even though Gatsby is popular among static site generators, there are not many articles explaining Gatsby in Japanese. I made it up as I went along, and got to know GraphQL pretty well. I finally finished the site and was about to publish it after writing a few articles when it occurred to me.

“Don’t I need React?”

One of the original purposes of moving to a static site generator should have been its lightness. Although it is a single-page application and page transitions are faster because there is no server interaction, I began to think that a site that uses a lot of React (Javascript) cannot be called lightweight. However, I have come to think that a site that uses React (Javascript) in a blatant way cannot be called light. It is far from being as lightweight as Hiroshi Abe’s website. In reality, however, there is no problem considering the current Internet connection speed and PC specifications. The only thing that bothers me is the slow build time during development. To put it bluntly, it is too slow. However, this is not a problem if you consider automation with GitHub Action. When you are in operation, you can just push to GitHub and leave it alone. When you go to bed and wake up, it is updated.

Although there was no problem, the more I thought about it, the more I realized that I did not need React for my personal blog. While agonizing over whether to continue with Gatsby or not, I came across Astro, a static site generator that I had seen frequently while reading Gatsby articles, but had not paid much attention to at the time. Astro allows you to create sites using modern frameworks such as React and Vue, but at build time, Astro eliminates them and rebuilds the site using HTML and CSS. This makes it possible to build very lightweight static sites. Of course, if you want to keep React, you can specify client:load to leave it as a component.

Migration from Gatsby is also easy. The .astro format is almost .jsx, and you can write articles in mdx, which gives you a lot of flexibility, and although you can’t use GraphQL, you can achieve similar functionality with content collections. I think after building either, I find it much easier than Gatsby in terms of learning costs.

So, now that we have a nice site, we are going to operate it with Astro. From a static site to a dynamic site and back to a static site again. History repeats itself.


Author

me

Fumito Iriya

Scientist (Ph.D.), Programer, Web Developer, Guitarist, Photographer

more...