-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Content collections] Apply MDX components on render (#6064)
* fix: apply MDX components during render() * test: MDX components export in SSG and SSR * chore: changeset
- Loading branch information
1 parent
01ef1e5
commit 2fb72c8
Showing
7 changed files
with
107 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Apply MDX `components` export when rendering as a content collection entry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
--- | ||
|
||
<h2 data-components-export-applied="true"><slot /></h2> |
18 changes: 18 additions & 0 deletions
18
.../test/fixtures/content/src/content/blog/promo/launch-week-components-export.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
title: 'Launch week!' | ||
description: 'Join us for the exciting launch of SPACE BLOG' | ||
publishedDate: 'Sat May 21 2022 00:00:00 GMT-0400 (Eastern Daylight Time)' | ||
tags: ['announcement'] | ||
--- | ||
|
||
import H2 from '../../../components/H2.astro'; | ||
|
||
export const components = { h2: H2 }; | ||
|
||
Join us for the space blog launch! | ||
|
||
## Details | ||
|
||
- THIS THURSDAY | ||
- Houston, TX | ||
- Dress code: **interstellar casual** ✨ |
14 changes: 14 additions & 0 deletions
14
packages/astro/test/fixtures/content/src/pages/launch-week-components-export.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
import { getEntryBySlug } from 'astro:content'; | ||
const entry = await getEntryBySlug('blog', 'promo/launch-week-components-export'); | ||
const { Content } = await entry.render(); | ||
--- | ||
<html> | ||
<head> | ||
<title>Launch Week</title> | ||
</head> | ||
<body> | ||
<Content /> | ||
</body> | ||
</html> |