Astro Sanity Blog Demo

Overview

This is the next stage of the Astro blog demo but this time incorporating Sanity CMS to provide content rather than SSG via MDX files, in the original astro-blog repository.

A demo of the site can be found here.

Bun

Bun has been used as the package manager and local dev server. The offical documentation can be found here.

Commands

All commands are run from the root of the astro-blog folder, from a terminal:

Command Action
bun install Installs dependencies
bun --bun astro dev Starts local dev server at localhost:4321
bun --bun astro build Build your production site to ./dist/
bun --bun astro preview Preview your build locally, before deploying
bunx astro add react Use Astro integrations with astro add command

Sanity Studio

Sanity provides a customisable React based project called Sanity Studio for managing your CMS content on a per project basis. The application supports both a content management system and a query tool for testing relational queries.

Sanity uses GROQ (Graph-Relational Object Queries) for accessing data. The documentation for GROQ can be found here.

For further information regarding integration with Sanity please read the documentation here.

Additional links:

Environment Variables

Once you have created a project on the sanity.io website, you will need to copy the .env.template files to .env versions, in both project directories, and populate with the values for your project. These environment variables can then be provided via Netlify or any other hosting provider you choose but I would highly recommend this platform.