[MDX] Astro.props.content -> frontmatter (#4237)
* docs: MDX Astro.props.content -> frontmatter * chore: changeset
This commit is contained in:
parent
a862da8aae
commit
9d5ab55086
2 changed files with 9 additions and 4 deletions
5
.changeset/neat-bats-heal.md
Normal file
5
.changeset/neat-bats-heal.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@astrojs/mdx': patch
|
||||
---
|
||||
|
||||
Update "Astro.props.content" -> "Astro.props.frontmatter" in README
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue