Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Astro component support #500

Closed
samaritanau opened this issue Oct 8, 2023 · 4 comments
Closed

Astro component support #500

samaritanau opened this issue Oct 8, 2023 · 4 comments

Comments

@samaritanau
Copy link

Hello, we are writing an Astro site and want to create a "rich-text-astro-renderer". Does anyone know if that has been done yet?

@YvesRijckaert
Copy link
Contributor

Hi @samaritanau
I have not seen that before, can you help me understand what would make this renderer different from rich-text-html-renderer?
In the Astro docs it seems like they are using rich-text-html-renderer
https://docs.astro.build/en/guides/cms/contentful/#static-site-generation

@samaritanau
Copy link
Author

samaritanau commented Oct 14, 2023

Hi @YvesRijckaert ,

The html renderer just renders out html, however we need to render out Astro components, so we can get the functionality of the components. We have implemented this now with an Astro components that basically follows the patterns in the html renderer, seems to be working ok. I was going to submit a pull request, however I wasn't able to get it running in the code base.

@ttntm
Copy link

ttntm commented Nov 2, 2023

Came across this issue (withastro/roadmap#533) recently which could make it possible to use Astro components from within the HTML renderer in the future.

@samaritanau
Copy link
Author

Just in case anyone is looking to do something similar here is the basic Astro file we went with to render Contentful RTE JSON into HTML and/or Astro components, the LinkWrapper component and Image component referenced are specific to our use case (locale support and some other things) so you'll need to roll your own, but you'll get the gist. Maybe this will help somebody looking to do what we needed to.

RichTextAstroRenderer.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants