Keeping my sanity
January 4, 2020
After two weeks of intense learning and programming to switch out the former CMS of a Gatsby powered site for Sanity – mapping all content and generalising the components so we're less tied to a single CMS – I have a bit more insight into what it's like to work with.
What we've struggled with in the past has been a the flexibility of the system and the ability to integrate external content. In our case: content from Shopify, and especially the ability to add further details for those products.
I wrote a script to import all Shopify products and collections into Sanity, through the Storefront API, and saved the essential data so our clients can add additional data and settings to the product details pages. Then set up the Product type in Sanity Studio with title and Shopify handle as read only, and a Shopify ID as a hidden field. That means the products are searchable in Sanity Studio.
On top of that I created the following types:
- Store to power our store locator
- Site Settings to allow clients to change site details
- Article
- Category (for articles, not products)
- Homepage with repeatable sections to allow the client to structure content however they like
- Generic page so clients can create new pages that follow a predefined generic page design
- ... and a few others
I know this will sound like I'm a bit of a fan boy, but honestly, it's been really flexible to work with. Sanity basically takes whatever content you throw at it, then it's just a matter of mapping the Sanity Studio to the content.
Well, I'm convinced enough to run my personal blog on Sanity and dreaming about different ways to push the limits of Sanity's capabilities. Now I just have to convince the boss that it has everything our clients need, for now, so I didn't just do all that extra work in vain.