content icon indicating copy to clipboard operation
content copied to clipboard

How to display markdown from nuxt/content in server side route outside component

Open ipatate opened this issue 3 years ago • 6 comments

Hello, i've created a server route in nuxt 3 app for render a xml RSS feed for podcast. The content come from nuxt/content but when i want rendered the body, i can't find how to make this.

The file in the project https://github.com/double-slash-podcast/website/blob/969fe4bfa9f16097ce4def7d922b8869377a650a/server/routes/podcast-rss-feed.xml.ts#L164

thanks for help.

ipatate avatar Aug 18 '22 19:08 ipatate

i find this method :

await renderToString(h(ContentRenderer, {value: body}));

but i don't find how to import ContentRenderer

ipatate avatar Aug 19 '22 08:08 ipatate

Hey @ipatate

I believe the Islands components might be the solution for it: https://github.com/nuxt/framework/pull/5689

It will soon land 😊

The idea of using ContentRenderer is nice but as soon as you have Vue components inside, it will loose the ability to find them, this is where the island components come in!

atinux avatar Aug 19 '22 08:08 atinux

okay @Atinux. Island component, interesting 👍 thanks At the moment I'm having a really hard time using nuxt/content outside of the application. Maybe, it's not thinking for that.

ipatate avatar Aug 19 '22 09:08 ipatate

@ipatate

It would be also worth checking #1177, as a solution for the time being.

nozomuikuta avatar Aug 19 '22 09:08 nozomuikuta

thanks @NozomuIkuta, i tried this method and it's works.

ipatate avatar Aug 19 '22 15:08 ipatate