Join the Webstudio community

Updated 3 months ago

API Data in rich-text format

At a glance
quick question about fetching Data from Notion which u probably know.

I want to Display a Notion Textfield via API with the rich-text format. But i cant figure out which expression configuration is correct.

Right now, i use the following expression.

.data.results[0].properties.Veranstaltungsbeschreibung["rich_text"][0]["plain_text"]

it is displaying the text, but as expected Plain without the rich-text format.
i tried

*".data.results[0].properties.Veranstaltungsbeschreibung["rich_text"][0].text.content " *

aswell, same result.

Do you know how to fetch the data correct to display it with all the paragraphs etc.?

Thanks a lot for helping all the time ❤️
B
M
p
9 comments
Sadly notion does not provide html or markdown to display rich text, but only proprietary rich text ast format.
You can make your own middleware to have it and parse the content. I already have a (little) POC on that and I figure out how to use Notion as an headless CMS. When I will have more time I will publish a solution for that!
sounds interesting. How did u solve that case specific?
I need to switch the CMS if i cant find a way to figure that out, but wanted to stay with notion as possible.

Would highly appreciate ❤️
I needed to code all the solution. You need to make 3 API calls + parse the content of Notion's page. It's not really plug and play right now... Notion API is really a mess. I love using Notion but I hate to use the Notion API.

You have 2 options right now :
1/ You code yourself the solution
2/ You change the CMS

Third option: you can wait I ship the solution ^^
Yeah, i think Airtable will be the way.
I am trying this out real quick.

But the thing i struggle with is the rich-text aswell.
i connected the Airtable and fetched the data correctly.

The Text Content on the right is displaying correct. Why is the text not?
Attachment
Bildschirmfoto_2024-10-09_um_10.59.41.png
FIXED - needed to use the Markdown component
Don't forget to inspect what the API is sending, it's better to debug. You don't know on the builder what really the API is sending!
Add a reply
Sign up and join the conversation on Discord