[MDX] Astro.props.content -> frontmatter (#4237)

* docs: MDX Astro.props.content -> frontmatter

* chore: changeset
This commit is contained in:
Ben Holmes 2022-08-10 14:43:35 -05:00 committed by GitHub
parent a862da8aae
commit 9d5ab55086
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View file

@ -0,0 +1,5 @@
---
'@astrojs/mdx': patch
---
Update "Astro.props.content" -> "Astro.props.frontmatter" in README

View file

@ -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>