未分類
Nuxt Content ルーティング仕様メモ(2025-10-02)
1. 基本ルール
- コンテンツファイルは、
apps/web/content/以下に配置する。 - ファイル名(拡張子を除く)とディレクトリ構造が、そのまま URL パスになる。
- 例:
content/nuxt-content-mdx-setup-guide.md→/nuxt-content-mdx-setup-guide - 例:
content/memo/2025-10-02/volta-setup.md→/memo/2025-10-02/volta-setup
- 例:
content/index.mdxはトップページに表示される。
2. フロントマター
推奨フィールド:
title: タイトル
description: 概要
publishedAt: 発行日 (ISO 8601)
updatedAt: 更新日 (任意)
tags: [タグ1, タグ2]
status: draft | published
visibility: public | private
3. Vue 側のルーティング
app/pages/index.vueで/にContentDoc path="/"を表示。app/pages/[...slug].vueでその他のパスを受け、ContentDoc :path="route.path"で表示。- Not Found 時は簡易メッセージとトップへのリンクを返す。
4. コンテンツ追加手順
content/配下に Markdown/MDX ファイルを作成。- フロントマターに基本情報を記入。
- 必要であれば
index.mdxにリンクを追加。 npm run devでプレビューし、URL パスを確認。
5. 参照
- Nuxt Content Documentation: https://content.nuxt.com/
- 仕様策定メモ:
memo/2025-10-01/nuxt-content-mdx-setup-guide.md