Nuxt.JS - How to Render Body Text Using the Portable Text Helper
Last updated: Apr 5, 2021
Hi all, I'm a beginner developer here trying to create my first blog on Sanity using Nuxt. I am having a horrific time trying to render body text using the Portable text helper for the npm package @nuxtjs/sanity. Is there a full working example somewhere someone can point me to? I would be tremendously grateful and indebted to this community, thank you so much.
Then in your component you import sanity from "../../sanityClient" in the script. Then you can use the block component:
<block-content :blocks="child" v-for="child in missionFirstParagraph" :key="child._id" />
In this example, missionFirstParagraph is the potable text that I'm pulling from sanity that I want to display in paragraph form. I found this site to be helpful https://developers.cloudflare.com/pages/tutorials/build-a-blog-using-nuxt-and-sanity Also there is a Nuxt channel in here that you should search for. Sometimes questions in Help get lost among all the different stuff, but in the Nuxt channel I've found people are really quick to respond and really helpful.
Apr 2, 2021, 1:40 AM
Ok thank you for your help! I didn't realize there was a Nuxt channel. I was able to use the cloudflare tutorial previously but that uses the sanity-blocks-vue-component and I was looking for a way to do it with just with @nuxtjs/sanity . Also the cloudflare tutorial and the nuxt events template use version 0.1.0 of sanity-blocks-vue-compondent and I was trying to implement the 1.0 version which has breaking changes I believe. Regardless though, I will stick with what works for now and appreciate your help!