Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

166
Views
How can I get body of markdown with Frontmatter?

I want to get the data of the body of my markdown file using the front matter but it is showing undefined, what shall I do to resolve the error?

{latest.map(({ url, frontmatter }) => (
<PostCard url={url} content={frontmatter.body}/>
))}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

See the Exported Properties section of the markdown guide in the docs.

frontmatter.body is not part of the list, instead you should use compiledContent() or rawContent() on the imported markdown object.

{latest.map(post => (
<PostCard url={post.url} content={post.compiledContent()} />
))}

Full example

When you have src/pages/posts/a.md, src/pages/posts/b.md, etc.

The following shows all files compiled contents successfully:

src/pages/index.astro

---
const posts = await Astro.glob('./posts/*.md')
---

<ul>
    {posts.map(post=>
    <li set:html={post.compiledContent()} />)}
</ul>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!