Skip to content

Blog

From WordPress.com to Starlight

Well, after a lot of consideration and playing with different ways of doing this site, I’ve finally made the DNS changes to move from WordPress.com to Starlight.

Why Starlight?

  • It’s fast. Really fast.
  • The basic navigation around pages is automatic once set up, and there’s a sidebar with a table of contents automatically too.
  • I want to write more ‘timeless’ stuff, not blog posts that mostly disappear in time. WordPress is, at heart, a blog. Starlight is for documentation. That feels like it fits better.
  • It’s got some geeky stuff to play with. I write in Nova, push changes to GitHub, and they appear live about a minute later.
  • Making old posts that had been linked to from other sites appear at the same URLs turned out to be quite easy, so I don’t break anyone else’s links.

There are drawbacks - the blogging plugin is a bit rudimentary, but it’ll do the job for now, and will likely improve later. I won’t be able to do the fancy photo-heavy layouts I used to do, but I haven’t done any of those in years. And I don’t think anyone missed them.

And I’m missing a Flickr logo for the social links. But I can either request that, or maybe try to learn how to do a pull request and add it myself. Bit beyond me right now, but I’d love to think I’d actually been able to contribute something, even if it’s a very minor something.

Starlight!

I’d pretty much settled on moving to Astro. I’d got things basically working. The site was decidedly lacking in features, but I could build it out slowly. It was fine.

But then I realised that several of the features I wanted - automatic navigation for static files, table of contents, light/dark mode - were built in to Starlight. And while I’d abandoned the idea of using Starlight because I’d hit some limitations, I’d learned a bit more about Astro since then, and Starlight is built on Astro. So maybe I should give it another look.

Starlight?

A documentation platform built on Astro. Not the obvious platform for what is, essentially, a personal blog. But I really want to write more ‘static’ stuff. Articles about photography. Guides and how-to articles, not just ‘what I did today’ blog posts. This post you’re reading now is a blog post, but I want my site to encourage me to write stuff that’s a bit less time-based, and hopefully, more useful in the longer term.

Starlight can have multiple collections of documents. Any new document added to a collection can automatically add itself to the sidebar for navigation. It has a table of contents in another sidebar, which gives readers an overview of longer documents, and lets them jump to the part they want.

Why I Abandoned It

I jumped around a lot of attempts when first starting this, so memory may be a little hazy, but I’m fairly sure I gave up on my attempts to make old posts from WordPress appear at their original URLs. Being able to do that, or at least redirect to them, was required. A few old posts still have some traction out there, and have been linked to, and I’m not willing to break that.

I’d tried using a ‘slug’ file to take over the URLs, which worked in Astro, but not in Starlight. I think it’s because Starlight actually does just that behind the scenes, hidden away in its modules, in a way that isn’t easy to override. But I’d missed something, I think because I didn’t know about it at the time. Adding the slugs to the frontmatter of the posts, just did what I wanted, super easily. The pages just take the URL given. Job done.

The other problem was that there was no blog, but a plugin has been made to do a bit of a basic half-assed blog function. It’s still being worked on, but it does the job well enough for now. Feeds would be nice, and many other ‘bloggy’ features would be nice too, but it adds a separate collection of dated posts. I think that’s enough for now.

Trying Starlight Again

So with that, I started chucking my content into Starlight. And it works well. It hasn’t taken long to get it to a pretty nice state; where with Astro, I’d barely made it usable at all, and it would probably take a lot more work to get what I wanted.

Writing, not Fiddling

That’s what it came down to. I think if I went with Astro, I’d have a fun new hobby of building my site, trying to add the features I wanted over the coming months. With Starlight, the important bits are already there, and other people are working on adding a lot of what’s missing. I can spend time writing actual articles for my site instead.

Learning to Learn Slowly

Not much progress with Astro today. I did manage to get a three-column layout working, using Tailwind for a CSS grid.

But for my next trick, I wanted to make a table of contents in one of the sidebars. It’s commonly done on documentation sites, so you can see where you are on a big page. Not super useful for a little blog post like this one, especially when it has no headers, but useful on longer pages.

But I tried copying code from several different sources to merge into what I already had, and it didn’t go well. I hit a problem each time where I realised I just didn’t understand what I was working with. I tried converting JavaScript into TypeScript without knowing much of either. I tried copying over code before noticing it was all made up of Preact components, and I don’t even have Preact installed. Don’t really even know what it is.

Time to back off. I need to do smaller bits, and understand them at least somewhat as I go, building on them to make the next step.

I think I need to accept that this site is not going to be ‘finished’ any time soon. Definitely not before my WordPress account comes up for renewal. But maybe it’s very close to being a minimum viable PigPog. As long as the old pages that are linked to elsewhere work usably, the rest can come later.

Moving to Tailwind

After my last post about getting started with Astro, I’m happy so far with my decision to start from (relative) scratch with a new install, just using the default Astro Blog as a starting point. Using a full theme someone else had written should make things easier, but it was a lot to start with, making it harder to understand what I had.

But I do want to make things easier on myself, and Tailwind sounded like a good way to do that. I haven’t really done much HTML since CSS came along, to be honest, and a lot about CSS has never really felt right to me. Tailwind seems to answer some of the problems I had with it. And it integrates really well with Astro. So I installed it, and set about converting just the footer into Tailwind.

It went well. The footer was a good starting point - not much to do, really, but enough to see how things work. It had a block of styles at the bottom of the .astro file, applying various styles. I just looked up what each one was in Tailwind, and added them to the relevant elements. Tweaked a few colours as I went, to make it look a little closer to what I want, and I was good to go.

There’s plenty more to do, but it does feel like it makes styling things a lot easier, so I’m happy so far.

First Astro Post

I’m working on moving PigPog from WordPress to Astro. And this is my first post written in Astro, having just got the basics up and running - admittedly, on my second attempt.

Astro?

I’d seen mentions of it a couple of times, tried looking to see what it was, and decided it wasn’t what I was looking for. I wanted a Static Site Generator (SSG), and it was a JavaScript Framework. I didn’t want that, I don’t want to throw lots of JavaScript at people’s browsers. But, I finally looked a bit further, and realised it actually is an SSG. Just an SSG that can also do other things. And while it works with all sorts of JS frameworks, and, technically, is one, it doesn’t, by default, send any JS to the browser.

I finally gave it a go, and things generally seemed to make more sense to me than they had in my experiments with Jekyll and Eleventy.

So Why Second Attempt?

I tried Starlight first. It’s a documentation platform based on Astro - a theme for it, maybe, or a bit more than that? And for some of what I want to do, it’s perfect. But my attempts to add blog posts and make some old posts from WordPress show up just weren’t working. I think, to be honest, a lot of that was my bad way of trying. I was taking chunks of code from blogging templates and trying to shove them into my Starlight installation without really understanding what I was doing. And that didn’t go well.

I started fresh. Twice, really, so it’s more of a third attempt, but the second attempt (I think!) was down to an old template that had some unfortunate version problems, relying on dependencies I didn’t really understand or want, overcomplicating things. I ditched that one quickly.

For this attempt, I just have the default Astro ‘blog’ template, and because I’m starting from the basics, it’s making it much easier to understand what’s going on.

Why Leave WordPress?

Isn’t WordPress fine? Yes. It is. But for a site that doesn’t make any money, it does cost a fair bit. And I didn’t find the media management to be much help when things get to a larger scale. As the storage limit starts to approach, I’d like to resize old images down a bit, but doing that would mean recreating all my photo blocks. Fine if you have a handfull of images in a few posts, but I have posts with 150+ photos.

And no, Astro doesn’t solve that problem. But that problem has made me rethink doing such photo-heavy posts in the first place, using Flickr for my photos instead. And if I’m doing that, I don’t need such a fancy blogging platform.

And the geeky side of me really loves the idea of writing locally, pushing the content to GitHub, and having my site just magically update itself.

Oh, and a static site hosted on an edge network can be really fast.

What’s Next?

I’ll continue fiddling with this, and see how it goes. The option is still there to just renew my WordPress subscription for another year and carry on. It really is fine. But if I can get this to a state where it feels like it could be home, eventually I’ll switch over my DNS, and this will become PigPog.