The word community with a heart.

Why choose Astro for your Dev site?

Published: 1/1/2024

I am a WordPress Developer, so why on earth did I choose Astro for my Dev site?

Seriously, I could have built this usingdis WordPress, but where the fun be in that! I wanted to learn something new, and Astro seemed like a good choice. I have been following the project for a while. It’s an intersting project and I wanted to see what I could do with it.

I have played about with a few static site generators in the past. I played with and loved Hugo. It was very easy to pick up, you didn’t need to know any JavaScript and I managed to connect it up to a content management system called Forestry.io (Now called Tina). I tried to learn Gatsby and quickly got bored. I found it very difficult to get my head around.

"A cute cat"

I selected Astro because in my mind I felt now was the time to get my hands dirty and learn a new way of doing things. WordPress, as much as I enjoy using it is not easy to maintain. You need a plugin for every little thing, well you don’t really, you could code the plugins yourself, but what you want probably already exists.

Security is a big issue with WordPress. Plugins go out of date on a daily basis and stuff just breaks all the time. It can become expensive to maintain a WordPress site. I have clients that pay an annual fee to keep their sites up to date. I have clients that don’t pay and their sites are a mess.

Astro takes care of all security issues

Because Astro is a static site generator, it generates static files with no database. Nothing to hack! No plugins to go out of date. No need to pay for updates. It’s a win-win situation.

Building with Astro

Build time will be slower than WordPress, but the site will be faster and more secure. I can live with that 😃. But I guess its rather subjective, is it slower to build?

It depends. When building with WordPress I use either Pinegrow and create a classic theme with zero dependencies or I use GeneratePress and create a block based theme around that.

When you use something like GeneratePress, you are still tied into theme updates and the like. Building your own classic theme can prevent that as you are in total control.

Building sites in Astro can be likened to creating your own classic theme. Astro has zero dependencies, you can use any framework you like. I am using Tailwind CSS, but you could use Bootstrap or any other framework you like. All teh usual stuff can be bolted on, sitemaps, robots.txt and the rest. Once you start building pages and posts, the sitemap will automatically update.

You can build anything with Astro

Astro is component based. You can build components which hold small pieces of data and then include them on any page, you can then change the data of those components depending on the page you are on. It’s a very powerful way of building sites.

For example, I can create a testimonial component with all the tailwind classes I need to display that component. Then once it is built I never need touch it again.

TailwindCSS and Astro make a perfect combo for this kind of development.

This site is built with Astro

I wanted a website which would work just as a blog with pagination as well as a projects section. I also wanted a working contact form, this can be done if you hosted with Netlify. If you host elsewhere, just use a third party form service and embed it.

So I managed to achieve all of these things. I purchased 2 courses, they were somewhat helpful. The biggest help to me was actually Google Gemini!

I used Gemini to help me work out small chunks of code which got me the results I wanted, and honestly it beats asking StackOverflow!

Next steps

I would like to integrate my new site with hashnode as a blog so that I can get the benefits of the hashnode community with a headless blog which would update whenever I post to hashnode.