Hello,
This might be error on my side, but I'm currently integration structured data into a React/Gatsby project.
I'm following this article: Add schema markup in CMS (Prismic) | Prismic Help Center
In step 3, you have said that we need to render the RichText field as HTML using the RichText.render method. However if I do that, this output html in this format:
My code for this is {RichText.render(structuredScript.raw)}
In order to actually render the script tag, we need to get the text value then wrap it in dangerouslySetInnerHTML tag
This worked for me:
<div dangerouslySetInnerHTML={{ __html: `${structuredScript.text}` }} />
Even though that this renders the script tag correctly, react Helmet unfortunately doesn't support dangerouslySetInnerHTML so this is not really a solution for us.
Any help will be greatly appreciated!
Thanks,
Kris