render()

render() compiles a content entry's body into a renderable Content component and metadata.

Since Astro 5.0 Spec ↗

Syntax

const { Content, headings } = await render(entry)

Returns

Promise<{ Content, headings, remarkPluginFrontmatter }> — A promise resolving to the Content component plus extracted headings and plugin data.

Examples

---
import { getEntry, render } from 'astro:content';
const post = await getEntry('blog', Astro.params.slug);
const { Content, headings } = await render(post);
---
<nav>
  {headings.map(h => <a href={`#${h.slug}`}>{h.text}</a>)}
</nav>
<Content />
Output
Builds a table of contents from headings and renders the Markdown body.

Notes

The standalone render() from astro:content is the current API; the older entry.render() method is deprecated. headings provides depth, slug, and text for building a TOC.

See also