DEV Community

Cover image for Why I switched from WordPress to astro
fratzinger
fratzinger

Posted on

Why I switched from WordPress to astro

Disclaimer: I'm a javascript person. I started developing WordPress websites over 10 years ago. Since then I've never learned PHP but developed web applications with js/ts instead.

The evolution of WordPress is impressive. Initially it was for blogs and became this massive CMS with thousands of plugins and themes. It's used on 43.2% of all websites on the internet. And that is for a reason. It's easy to spin up a website. With website builders you even don't need to know stuff about web development.

But I think WordPress is not the best fit for most websites:

Website type #1: Most websites are almost static. A onepager landing page with a few small other pages. Nothing you need a full blown CMS with a database and 10+ plugins for.

Website type #2: Other websites are totally individual with multiple content types, various pages, layouts, forms and several people maintain it. You need to customize WordPress a lot to get that website right.

In both scenarios you need a lot to know in the WordPress ecosystem: Which theme to start with? Which extensions are needed? How do I have to configure them?

And at the end you don't get exactly what you want.

I developed a type #1 website with WordPress two years ago and needed to improve this website now with custom stuff. Instead of tweaking this WordPress site, I decided to start from scratch with https://astro.build/

Here are the things I liked the most about this decision:

  1. Git as a "backend" instead of WordPress admin dashboard
  2. The whole JS-Ecosystem at my fingertips
  3. Clean website - I know exactly what's going on
  4. Performance

1. Git as a "backend"

This is a huge one. Our website does not change often. There are a few people who can make changes and who are relatively firm in programming. Our website has content pages and designed pages. The content pages are defined via markdown which is easy even for marketing people / content creators.

The power of a version control system compared to the WordPress admin dashboard is ridiculous. We can work on multiple branches, make reviews and with cloudflare pages / vercel / netlify we even have previews without leaving github / gitlab. Review processes are not limited to articles/pages like on WordPress, but can affect the whole website like the header or footer.

How do you even review changes on WordPress sites for new sections? In the past I cloned the website, made changes to the clone and merged the changes manually at the end. It's good to have git now.

2. JS-Ecosystem

As said, I'm a typescript fullstack dev. I know how to setup a website with HTML, CSS and js and how to use tools like vue, tailwind, etc. I do that on a daily basis. So why bother with WordPress? I'm quicker setting up an astro website with multiple pages and a blog than I would be with WordPress.

I've implemented some cool stuff on the new astro website. For example at build time, every page gets its own og:image based on a template. With the power of npm packages that was fairly easy. I don't know how to do that with WordPress.

3. Clean website

On a Wordpress site you quickly start searching for plugins to get a job done. But every plugin adds predefined css & js to your page. If you have a clear imagination of how things should look and behave like on your website, you'll end up adding custom css & js anyways. Even worse: you'll revert some applied css rules and add css with !important all over the place. What a mess!

With my astro setup I exactly know what's going on. There's no jQuery. There are no unnecessary css rules. Just my clean setup. Yes, for a new section I'll have to start from scratch but it's a neat setup. I don't need the inspector to know what's going on.

4. Performance

A waaay faster website for page visitors without a hassle is a nice addition. I don't need any fancy caching plugin. Almost all of the performance improvements are out of the box. Images get compressed at build time. client side js is only included where needed. I even know how to improve the performance even further. For example with partytown.

Conclusion

I know comparing astro with WordPress is not fair because they are two different things. But for this particular task of developing our website, I considered both and would choose astro every time again.

Developing with astro was such a joy.

But astro is relatively new. There are a few things that made me realize that. Here are things I had to work around:

  • astro does not support relative image paths in markdown files
  • import.meta.url has a different result for dev (correct file) and build (dist/entry.mjs)

Top comments (0)