Is it possible to convert rich text to plain text using the Sanity client?

2 replies
Last updated: Apr 1, 2024
Sanity is for sure my favorite CMS ever, but one thing I really loved that I could leverage in prismic was turning rich text into plain text strings $prismic.asText(pageData.text) for instance. Is this something that is currently possible utilizing the sanity client?
Apr 1, 2024, 3:05 AM
You can do this in groq: https://www.sanity.io/docs/groq-functions#1467558a0339

"content": pt::text(content)
Apr 1, 2024, 7:01 AM
user A
wow easy easy. thank you!
Apr 1, 2024, 3:04 PM

Sanity – Build the way you think, not the way your CMS thinks

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.

Was this answer helpful?