
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeI can help you with this! The issue you're experiencing is because @sanity/block-content-to-react is deprecated and has been replaced by the newer @portabletext/react library. The older package has some limitations and doesn't handle all Portable Text features as reliably as the modern replacement.
Looking at your code on GitHub, you're using the deprecated package, which is likely why headers, spacing, and line breaks aren't rendering properly while basic marks like bold and italics still work.
1. Install the new package:
npm install @portabletext/react2. Update your imports in [slug].js:
// Replace this:
import BlockContent from "@sanity/block-content-to-react";
// With this:
import { PortableText } from "@portabletext/react";3. Update how you render the content:
// Replace this:
<BlockContent
blocks={body}
projectId="your-project-id"
dataset="production"
/>
// With this:
<PortableText value={body} />The new library automatically handles all standard Portable Text elements (headings, paragraphs, lists, line breaks, etc.) out of the box without needing to pass projectId or dataset.
You can pass custom components to control how different elements render:
const components = {
block: {
h1: ({children}) => <h1 className="text-4xl font-bold">{children}</h1>,
h2: ({children}) => <h2 className="text-3xl font-bold">{children}</h2>,
normal: ({children}) => <p className="my-4">{children}</p>,
},
marks: {
link: ({value, children}) => <a href={value.href} className="text-blue-500">{children}</a>,
}
}
<PortableText value={body} components={components} />Key differences in the migration:
blocks to valuenode prop in custom serializers is now called valueblock, marks, list, and types categoriesThis should fix all your rendering issues on your Ellies Lego Land site! The @portabletext/react library properly handles spacing, line breaks, and all heading levels that the older package struggled with. Check out the ultimate guide for customizing Portable Text if you need more advanced customization options.
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store