Gerard O'Neill

I Just Rebuilt My Website!

Aug 28, 2023

A few days ago, I decided that my website needed an overhaul. Previously, my website was built using Hugo, which is a fairly clunky static site generator compared to other options these days. I wanted something better-designed, easier to update, and with fresh content, since my previous site hadn’t been updated in years. I definitely think I achieved all of that!

This site is built using Astro, with a headless WordPress site behind the scenes for dynamic content—namely, the blog and work portfolio. Many people look down on WordPress, but most of them have never actually used it. I had some experience using it as a headless CMS from a contract job, so I knew that it could be done well. Not only that, but it can be self-hosted and is free and open-source!

If this is a route you want to go down as well, here are some tips:

  • The Pods plugin is great for creating custom post types (e.g. my work examples) as well as custom field types. Most people would reach for Advanced Custom Fields, but when I tried it out, I ran into a bug fairly quickly that has been reported by numerous people over the last few years. I had no hope that it would ever get fixed, so I switched to Pods and am very happy with it.
  • Skip local development. Setting up WordPress locally is a huge pain, and since so much configuration is done in the database, there’s a lot of overhead in making sure that your development and production environments are in sync. For a simple headless CMS, WPCode should be more than enough to add custom code. As long as you are backing up your server, there shouldn’t be a problem developing in production since the changes will be small and your site’s visitors aren’t actually interacting with WordPress.
  • Use WP Headless Trigger to automatically rebuild your site when a post is saved.
  • Create a custom theme to completely remove the front-end. All you need is a style.css file and an index.php file, the latter of which contains header("Location: REDIRECT_URL"). You can redirect to your static site or your admin panel. In either case, you’re removing an entire attack vector from your WordPress site!

There are more things to consider, but this should be enough to get you started on your headless WordPress journey. If you’re interested in having something like this built for you or your organization, feel free to reach out!

Want to see more content like this? Consider subscribing to my newsletter!