Astro Sanity screenshot

Astro Sanity

Author Avatar Theme by Treefarmstudio
Updated: 7 Jan 2024
101 Stars

This is a helper package to integrate Astro and Sanity

Categories

Overview:

The Astro + Sanity Integration plugin has been deprecated and users are advised to refer to the official Sanity + Astro Plugin going forward. This helper package facilitates integrating Sanity with Astro, following a similar architecture to Sanity’s official packages for frameworks like NextJS.

Features:

  • Integration with Sanity: Facilitates integration of Sanity CMS with Astro static site generator.
  • Flexibility: Provides building blocks to integrate with Sanity and allows customization.
  • Helper Functions: Includes helper function names for implementing the integration in a customized manner.
  • Global Access to Sanity Client: Allows global usage of Sanity Client configuration in the project.
  • Querying Sanity Data: Provides an example of querying data from Sanity using the configured client.
  • Image Builder Helper: Guide on creating a custom function to build images using Sanity’s image builder.
  • PortableText Serializer: Instructions on creating a custom portableTextToHtml serializer for HTML conversion.
  • PortableText Astro Component: Demonstrates how to create and use a PortableText component in Astro files.

Installation:

To install the Astro + Sanity Integration plugin, follow these steps:

  1. Follow the installation prompts to set up the plugin.
  2. Update the astro.config.mjs file with the required configurations.
  3. Adjust the Sanity config to match your Sanity Client Config settings.

Summary:

The Astro + Sanity Integration plugin, though now deprecated, offers a convenient way to integrate Sanity with Astro. Despite not being an official package from Sanity, it follows a similar architecture to their other framework integrations. Users can leverage the provided helper functions for customization, access the Sanity Client globally, query data from Sanity, create custom image builders, and develop portableText serializers and components for enhanced functionality. For further assistance or inquiries, users can contact the developers via Discord or by raising issues on the repository.