Adding custom blocks through a plugin in Sanity.io

3 replies
Last updated: Jun 19, 2020
can you expose custom blocks through a plugin?
Jun 19, 2020, 5:52 PM
Yes, that is, if I understand you correctly. For example, our code-input plugin lets you add a custom block like this:
{
  name: 'content',
  type: 'array',
  of: [
    { type: 'block' },
    { type: 'code' },
  ]
}

https://github.com/sanity-io/sanity/tree/next/packages/%40sanity/code-input
Jun 19, 2020, 8:38 PM
Yes, that is, if I understand you correctly. For example, our code-input plugin lets you add a custom block like this:
{
  name: 'content',
  type: 'array',
  of: [
    { type: 'block' },
    { type: 'code' },
  ]
}

https://github.com/sanity-io/sanity/tree/next/packages/%40sanity/code-input
Jun 19, 2020, 8:38 PM
yeah, it turned out that I needed to restart sanity, and it worked again
Jun 19, 2020, 9:53 PM

Sanity– build remarkable experiences at scale

The Sanity Composable Content Cloud is the headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?

Categorized in