useFrontmatter() returns {} in layouts with the React adapter
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- react, typescript
- 領域
- frontend
調査の方向性
Start in @void/md/dist/plugin.mjs at emitReactComponent and @void/react/dist/runtime/pages-server.mjs where layouts wrap page elements; the issue identifies the frontmatter provider and layout placement as the likely cause. Reproduce with the linked project and compare useFrontmatter() in pages/layout.tsx with the page title. Done when the layout receives the Markdown page's frontmatter and the reproduction shows its title instead of {}.
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
The Markdown guide says layouts can read the current page's frontmatter with useFrontmatter() (Frontmatter Access). With @void/react, calling it from a layout that wraps a .md page returns {}.
Reproduction
https://github.com/Nkzn/void-md-layout-frontmatter-repro
pnpm install
pnpm dev # or: pnpm build && pnpm preview
pages/layout.tsx renders JSON.stringify(useFrontmatter()) around pages/index.md (title: Hello from frontmatter).
- Expected:
layout frontmatter: {"title":"Hello from frontmatter",...} - Actual:
layout frontmatter: {}(while<title>is correctlyHello from frontmatter)
Possible cause
The React component generated by @void/md provides the frontmatter context only around the Markdown body:
@void/md/dist/plugin.mjs(emitReactComponent, around L69–L115):MarkdownPagereturns<FrontmatterContext.Provider value={__frontmatter}>…</FrontmatterContext.Provider>.@void/react/dist/runtime/pages-server.mjs(L121): layouts are wrapped outside the page element, so they render above the provider anduseContext(FrontmatterContext)falls back to{}.
Workaround
Pass the page path to the layout (e.g. one named layout per page) and read the frontmatter from @void/md/pages instead of useFrontmatter().
Versions
[email protected],@void/[email protected],@void/[email protected][email protected], Node.js 24, pnpm 12, macOS
- 主要言語
- TypeScript
- スター
- 402
- フォーク
- 32
- 平均マージ
- 13時間 14分
- マージ済み PR(30日)
- 73
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
voidzero-dev/void のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
voidzero-dev/void#463 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
voidzero-dev/void#459 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
voidzero-dev/void#428 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 53/100
voidzero-dev/void#472 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
voidzero-dev/void#471 ·
メンテナーはふだん 1 日以内に返信
voidzero-dev/void の issue をすべて見る
似ている issue
-
backend priority:P3 privacy-fix
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
bug desktop v3 windows
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
esengine/DeepSeek-Reasonix#13697 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
area:security documentation effort:S priority:P2
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
app:web meta:ops
難易度 2/5 半日 初心者へのやさしさ 78/100
osu-tournament-rating/otr#1113 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100