Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sanity/astro

Package Overview
Dependencies
Maintainers
38
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sanity/astro

Official Sanity Astro integration

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6.1K
decreased by-4.52%
Maintainers
38
Weekly downloads
 
Created
Source

@sanity/astro

Official Sanity Astro integration

Installation

In your Astro project, run the following command to install the Sanity Astro integration

npx astro add @sanity/astro

Usage in Astro

Configure the integration in your astro.config.mjs file. The configuration options are the same as for @sanity/client.

import sanity from "@sanity/astro";
import { defineConfig } from "astro/config";

// https://astro.build/config
export default defineConfig({
  integrations: [
    sanity({
      projectId: "3do82whm",
      dataset: "next",
      useCdn: true,
    }),
  ],
});

PortableText

We recommend using astro-portabletext to render your PortableText fields in Astro. See an example of this in apps/example/src/components/PortableText.astro, including using custom components to render custom blocks and annotations.

Presenting images

We recommend using @sanity/image-url to help you generate URLs for presenting Sanity images in your Astro app. See an example of this in apps/example/src/components/SanityImage.astro

Learning

Please see our guided tutorial on how to create a blog with Sanity content in Astro to get started from scratch with both Sanity and Astro.

Keywords

FAQs

Package last updated on 22 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc