HomeBlogSwitchesChat
© 2026 nehno.com
Made with Next.js, Tailwind, shadcn/ui, next-intl, Sanity.io, and Supabase
← Back to posts

Sanity.io Experiment

A
Andrew LaiJanuary 11, 2025
Software Development
Sanity.io Experiment

Another time for testing out different headless CMS! Last time I tried GraphCMS (now Hypgraph) and before that was Prismic. The one that seems to be popular these days is Sanity.io so we're giving that a try!

So far it's pretty different in that you setup a "studio" locally that you can really fully customize to have a schema you like and then you deploy it to Sanity where anyone who has permissions can do things like make blog posts (if your studio is setup that way). The local studio seems to sync in real time with the deployed Sanity studio in that you can make edits to say a blog post locally and it will reflect that in the online deployed Sanity studio. Pretty cool so far.

It looks like for code snippets you'll have to modify the schema but it looks like there are plugins that people have made that are installable. Hopefully that will make things much easier.

Out of the box, Hygraph (formerly GraphCMS) had much more things readily available. Things like inline code marks and code block inputs were already there. Sanity.io took a little more setup. For example, to allow for inline code or numbered lists, I had to add to marks.decorators (in my Sanity studio repo) for it to show as an option to use:

For code blocks like the one I used above, I had to install a plugin, add it as a plugin in sanity.config.ts, and then add it to blockContent.ts

After which, I then had to figure out how to properly style the <code>content</code> that gets rendered in my frontend repo which is surprisingly difficult to find in the docs. It's in the marks.code section of PortableTextComponents by the way:

The benefit of Sanity.io though, is that you really have full control over pretty much anything. It is really customizable (if you're a developer).

Personally, I don't need that much CMS customization for this blog and I'm just by myself here so it would have been quicker if I had just used Hygraph. However, if you need a CMS for a company, I can see Sanity.io being really great as it's powerful and the collaboration experience between developers and users of the CMS appears to be quite smooth and seamless.

If I had to choose a headless CMS again for this blog, I'd probably end up using Hygraph. Getting simple tables to render in Hygraph's content editor was a lot simpler to do. If I were to choose for a company though, it really depends on the requirements and needs of the team.

Update

I've now ran into a strange issue where I've uploaded some images to Sanity.io and they no longer get returned in the query for my assets and are not visible in the Sanity UI. It does seem like it exists some place as when I try to reupload the image it errors with "Asset already exists".