Rendering Content

Mar 27 2023

Shifting from .body to .render()

I’ve been going back and forth with this. Ideally, I would be able to display the entire content of a markdown post on this page, with the markdown rendering into HTML. But when it comes to display a collection entry on a page, I have issues with the render function.

Astro supports passing content into component props, but following that still led me to the error that the content being passed to render() is undefined.

The issue is that getEntryBySlug wants a collection and a specific slug. I don’t seem to be able to place a variable for it instead. If I pass in the render function on the page for a property of the component, it generates [object, object] and not the actual content.