mirror of
https://github.com/withastro/astro.git
synced 2025-01-27 22:19:04 -05:00
[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
|
```astro
|
||||||
---
|
---
|
||||||
// src/layouts/BaseLayout.astro
|
// src/layouts/BaseLayout.astro
|
||||||
const { content } = Astro.props;
|
const { frontmatter } = Astro.props;
|
||||||
---
|
---
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>{content.title}</title>
|
<title>{frontmatter.title}</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>{content.title}</h1>
|
<h1>{frontmatter.title}</h1>
|
||||||
<!-- Rendered MDX will be passed into the default slot. -->
|
<!-- Rendered MDX will be passed into the default slot. -->
|
||||||
<slot />
|
<slot />
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Add table
Reference in a new issue