We have built a starter project to make it super easy creating a new website with a sanity.io back-end. Getting a new project up and ready is as simple as
When ready, you can connect a headless CMS of your choice. Currently, only Sanity.io is supported. To connect sanity make sure
sanity-cliis installed and run:
sanity init --output-path ./sanity-studio --template clean
sanity install @onlyhtml/sanity-plugin-onlyhtml-connector
This will create a folder named sanity-studio where we have our sanity studio project with the OnlyHtml plugin installed. The next step will be to configure Sanity and OnlyHtml, first edit
<your-site>/sanity-studio/sanity.jsonand put an empty array in the
partsfield. This is important to allow OnlyHtml to control the studio's structure.
The final file should look like this
Then we need to configure OnlyHtml, open
# add all below this
After doing so we can fire up our new CMS dashboard by running
# export onlyhtml schema into sanity studio
onlyhtml export sanity \
# fireup the sanity studio dev server
localhost:3333to view and edit your website's content. When ready, you can run
sanity deployto deploy the dashboard publicly.
Sanity.io is a headless CMS providing a unified content platform. It is very developer friendly and allows defining schemas and data types directly from code.
The Sanity Studio is an open-source CMS built with React.js. It offers rapid configuration and free form customization. A developer can spin one up locally and when ready deploy the studio to production so non-technical users can use it too.
Main features include
- Document revision history with rollback to editing sessions.
- Real-time collaboration. No locking or overwriting.
- Works on your phone and other touch devices.
- Batch image uploads. Paste pictures right from the clipboard.
- Large ecosystem of plugins
While developing, sanity studio runs locally in its own process, auto-reloading on any code or configuration change. Running
npm run servewill start two servers, one for sanity Studio and the other for OnlyHtml. Edit the content in Sanity Studio and it will automaticlly appear in the website preview.
When your website is ready for publishing, run sanity deploy and follow the instructions from the sanity tool. This will deploy the Sanity Studio to a publicly available domain so anyone with credentials will be able to edit the content of your new website.