Update: I discovered that the new Astro render(...)
function returns headings with a schema that still uses slug
where I had globally replaced all references of slug with id
. So I had to fix my TableOfContents
component to work with the Heading
schema. Now table of contents links in the page should work!
A new year ushers in site upgrades. I’ve upgraded from Astro 4 to Astro 5 with minimal effort. Astro 5 was announced in December and introduced a number of new features that I doubt I’ll have much need for. However, there are features I’m looking to leverage to improve this site (e.g. tags, deeper content hierarchies, etc.) and I don’t want to use deprecated features.
For those currently on Astro 4 and looking to upgrade to Astro 5, be sure to follow the very clear upgrade instructions here. I also consulted my theme’s upgrade upgrade PR for further guidance.
My biggest 🤦🏻 “facepalm moment” was trying to figure out why the routes to my indivual blogs were note resolving:
13:46:49 [WARN] [router] A `getStaticPaths()` route pattern was matched, but no matching static path was found for requested path `/blog/2025-01-11-astro5-upgrade`.
Possible dynamic routes being matched: src/pages/blog/[...slug].astro.
13:46:49 [404] /blog/2025-01-11-astro5-upgrade 431ms
As part of the upgrade, I had renamed ALL references to slug
to id
. And based on the error message above, it should be SUPER obvious what my problem was. I was still using slug
in my Astro dynamic route template. This is also indicative that I didn’t fully understand how Astro’s route and content system works. So I’ve learned a little by doing a little.
So, hopefully that is it for the upgrade! If you see an issue, comment here!