Previously, we have an article explaining why Sanity CMS doesn’t work in China already, we also have another article to go over the alternatives to Sanity CMS in China. In this blog, we are going to give you solutions in detail about how to make Sanity CMS work in China without changing your existing tech.
Getting Sanity CMS to work in China
We have two solutions for you to choose from, both of these solutions offer the best loading time experience to your websites’ readers as well as your content teams.
Solution 1: For teams outside of China
If you are outside of China, your website published with Sanity CMS is slow mainly because of two reasons:
1. Sanity CMS doesn’t have servers or CDN (Content Delivery Network) nodes in China.
This is obvious, but I still want to put it here because it is just one of the two reasons why your website is slow in China. For longer explaining why servers of Sanity CMS are slow in China, read Does Sanity Work in China? for reference.
2. Your website hosting provider doesn’t have servers or CDN nodes in China.
This is another reason why your website is slow in China.
Let’s take a look at how this relates to your website and the Sanity CMS. If we look at the website deployment process at a high level and say you are making a change on an article on your website. Here are what happen behind the scene:
-
When you press the “Save” or “Publish” button on an article in the dashboard of the Sanity CMS, the Sanity backend trigger a “build and deploy” message onto the hosting providers (the popular ones outside of China are Netlify and Vercel)
-
The hosting provider will pull the content from the servers of Sanity CMS and build the website inside the hosting provider’s servers.
-
Once the site is done building, the hosting provider will deploy the web pages on their content network.
If things go well with the above steps, the changes you just did on the article will be live and publicly accessible within the content networks by the hosting provider and the CMS provider.
So what happens when a user visits my website? The hosting provider will find the nearest server to the user and deliver the web page content from that server. The media assets also do the same when a user requests the content.
With that being said, what could go wrong here?
When your web hosting provider or the media assets provider have no servers in China, the default action they do is to find the nearest server (most likely to be in Hong Kong or Singapore) within their content network and serve the web page content and media from that server to your users. That’s the reason why your readers accessing the content fairly slow in China.
Now, we understand the problems then the solution is straightforward. Simply put, what your need is: a website and media assets hosting provider in China that integrated well with your website with Sanity CMS, which is exactly what 21YunBox does.
Talk is cheap, let’s show your engineers some code 😎
Here are the guides and the corresponding source codes to get your engineers started and experienced the speed boost with 21YunBox.
The starter website was provided by the Sanity CMS, what we did was that updated the code to support 21YunBox media asset CDN. It will become clear when you show this to your engineer, they can read the code and immediately get what I mean. The code solved the problem we described above.
Visually, what you will get is this after your get the starter deployed.
Once the website is up and running on 21YunBox CDN, we ran a speed test on the website in all the provinces and major cities in China, and here is the result:
The left one shows the load time with Sanity CMS Content Network vs the right one shows the load time with 21YunBox Content Network. You can see 21YunBox gives you the performance boosted (all solid green, meaning the image is loaded within 0.4 seconds).
Hopefully, by now, you have a good understanding of why your website with Sanity CMS is slow in China, and what you can do to fix it.
Solution 2: For teams in China
If your content team is in China already, they are likely to experience hangs of the user interface of Sanity CMS already. A quick and easy fix for this is to utilize VPN (Virtual Private Network) or some proxies on your content team’s computers so they can access the Sanity CMS much smoother.
Keep in mind that this only enhances the editing and publishing experience for your content team, it doesn’t help with your users’ reading experience. Then, you can use solution 1 above to give your website a speed boost in China.