Skip to content

Commit

Permalink
feat(core): support custom pageMeta in js mdx loader (web-infra-dev#734)
Browse files Browse the repository at this point in the history
  • Loading branch information
10Derozan committed Mar 7, 2024
1 parent cfbc7eb commit 3860b74
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/orange-falcons-mate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rspress/core': minor
---

feat: support custom pageMeta in js mdx loader
2 changes: 1 addition & 1 deletion packages/core/src/node/mdx/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export default async function mdxLoader(
title: string;
};
pageMeta = {
toc: compilationMeta.toc,
...compilationMeta,
title: frontmatter.title || compilationMeta.title || '',
frontmatter,
} as PageMeta;
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/runtime/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,12 @@ export async function initPageData(routePath: string): Promise<PageData> {
toc = [],
title = '',
frontmatter = {},
...rest
} = MDX_REGEXP.test(matchedRoute.filePath) ? meta : mod;
return {
siteData,
page: {
...rest,
pagePath,
...extractPageInfo,
pageType: frontmatter?.pageType || 'doc',
Expand Down

0 comments on commit 3860b74

Please sign in to comment.