
Simplifying SEO Schema in Svelte and Astro
If you look after a blog or content site, you probably already know structured data (Schema.org) matters for search. It can be the difference between a plain blue link and a Google result with things like images and ratings.
When I first set up publishing for my Svelte and Astro sites, I used components for the schema. I wrote custom Svelte components that put Microdata attributes into the HTML all over the site. It seemed like a good idea at the time, as everything was a component, but it turned into a pain to maintain.
I recently threw a lot of those components away for something much simpler with no runtime library. This is what I did, and why I think you might not need an SEO library either.
Table of Contents
Try the Simple Option First
When something seems complicated, like SEO, state management or how to structure components, it’s easy to go looking for a framework specific library to handle it.
This was a reminder for me that the language and the tools I already have are sometimes enough. Astro’s set:html and the types from schema-dts did the job, and I think it’s a lot easier to maintain than another runtime library would have been.