Skip to content
Advertisement

add block-input from sanity.io to next.js blog post

I’m developing a blog on next.js with sanity.io, and I’m having trouble using the code-input plugin.

What I do have I’m able to use the code component block on sanity, which looks something like this: enter image description here

Everything good on the sanity side. My problem comes with using it on the next.js [slug].js file.

I have this error prompt out: enter image description here

This issue with this is that I don’t have a serializer.js file/component anywhere on my code, not even on the studio root folder. I’ve seen this applies for gatsby but I don’t know how to apply it for Next.js

This is what I currently Have:

JavaScript

I really would appreciate some help here! Thanks <3

Advertisement

Answer

You can pass a serializer for the code block type to your BlockContent using the serializers prop.

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement