Skip to content

Commit

Permalink
[MDX] Astro.props.content -> frontmatter (#4237)
Browse files Browse the repository at this point in the history
* docs: MDX Astro.props.content -> frontmatter

* chore: changeset
  • Loading branch information
bholmesdev authored Aug 10, 2022
1 parent a862da8 commit 9d5ab55
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/neat-bats-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/mdx': patch
---

Update "Astro.props.content" -> "Astro.props.frontmatter" in README
8 changes: 4 additions & 4 deletions packages/integrations/mdx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,19 +195,19 @@ title: 'My Blog Post'
---
```

Then, you can retrieve all other frontmatter properties from your layout via the `content` property, and render your MDX using the default [`<slot />`](https://docs.astro.build/en/core-concepts/astro-components/#slots):
Then, you can retrieve all other frontmatter properties from your layout via the `frontmatter` property, and render your MDX using the default [`<slot />`](https://docs.astro.build/en/core-concepts/astro-components/#slots):

```astro
---
// src/layouts/BaseLayout.astro
const { content } = Astro.props;
const { frontmatter } = Astro.props;
---
<html>
<head>
<title>{content.title}</title>
<title>{frontmatter.title}</title>
</head>
<body>
<h1>{content.title}</h1>
<h1>{frontmatter.title}</h1>
<!-- Rendered MDX will be passed into the default slot. -->
<slot />
</body>
Expand Down

0 comments on commit 9d5ab55

Please sign in to comment.