From 25758deb1cf16ccd5a6696003eedab7b03ebd1c4 Mon Sep 17 00:00:00 2001 From: ryosanhin <90621212+ryosanhin@users.noreply.github.com> Date: Wed, 30 Sep 2026 23:37:50 +0900 Subject: [PATCH 1/8] =?UTF-8?q?feat:=20getEntry=E3=82=92=E4=BD=BF=E3=81=A3?= =?UTF-8?q?=E3=81=9F=E3=83=9A=E3=83=BC=E3=82=B8=E3=81=AB=E3=81=99=E3=82=8B?= =?UTF-8?q?=EF=BC=88=E4=BB=AE=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/docs/[...slug].astro | 65 +++++++++++++++++++++++----------- src/pages/docs/[slug].astro | 45 ----------------------- 2 files changed, 44 insertions(+), 66 deletions(-) delete mode 100644 src/pages/docs/[slug].astro diff --git a/src/pages/docs/[...slug].astro b/src/pages/docs/[...slug].astro index c333a81..3e1ea20 100644 --- a/src/pages/docs/[...slug].astro +++ b/src/pages/docs/[...slug].astro @@ -1,32 +1,55 @@ --- // ------------------------------------ -// ドキュメント本体を表示する用のファイル +// 目次・記事統合版ファイル // ------------------------------------ -import { getCollection, render } from "astro:content"; +import { getCollection, getEntry, render } from "astro:content"; import Layout from "../../layouts/Layout.astro"; -export async function getStaticPaths() { - const docs = await getCollection("docs"); +const { slug } = Astro.params; - return docs.map((doc) => { - return { - params: { slug: doc.id }, - props: { doc }, - }; - }); -} +const metaData = await getEntry("metaData", `${slug}/meta`); + +let article; +let Content; +let filteredDocs = []; -const { doc } = Astro.props; -const { Content } = await render(doc); +if (metaData) { + filteredDocs = await getCollection("docs", ({ id }) => id.startsWith(`${slug}/`)); +} else { + article = await getEntry("docs", slug); -export const prerender = true; + if (article) { + const rendered = await render(article); + Content = rendered.Content; + } +} --- - -

{doc.data.title}

- {doc.data.description &&

{doc.data.description}

} -
- -
-
+{ + metaData ? ( + +

{metaData.data.categoryName} ドキュメント一覧

+ +
+ ) : ( + +

{article.data.title}

+ {article.data.description &&

{article.data.description}

} +
+ +
+
+ ) +} diff --git a/src/pages/docs/[slug].astro b/src/pages/docs/[slug].astro deleted file mode 100644 index 3ff77f1..0000000 --- a/src/pages/docs/[slug].astro +++ /dev/null @@ -1,45 +0,0 @@ ---- -// ------------------------------------ -// 目次用のファイル -// ------------------------------------ -import { getCollection } from "astro:content"; - -import Layout from "../../layouts/Layout.astro"; - -export async function getStaticPaths() { - const metaDatas = await getCollection("metaData"); - const docs = await getCollection("docs"); - - // 重複の無いカテゴリ名を抽出 - return metaDatas.map((metaData) => { - const dirPath = metaData.id.split("/").slice(0, -1).join("/"); - const extractedDocs = docs.filter((doc) => doc.id.startsWith(`${dirPath}/`)); - return { - params: { slug: dirPath }, - props: { category: metaData.data.categoryName, docs: extractedDocs }, - }; - }); -} - -const { category, docs } = Astro.props; - -export const prerender = true; ---- - - -

{category} ドキュメント一覧

- -
From 16f310a3827cf456e3d71f1e250456fe2185ef71 Mon Sep 17 00:00:00 2001 From: ryosanhin <90621212+ryosanhin@users.noreply.github.com> Date: Thu, 1 Oct 2026 22:29:22 +0900 Subject: [PATCH 2/8] =?UTF-8?q?revert:=20Revert=20"feat:=20getEntry?= =?UTF-8?q?=E3=82=92=E4=BD=BF=E3=81=A3=E3=81=9F=E3=83=9A=E3=83=BC=E3=82=B8?= =?UTF-8?q?=E3=81=AB=E3=81=99=E3=82=8B=EF=BC=88=E4=BB=AE=EF=BC=89"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 25758deb1cf16ccd5a6696003eedab7b03ebd1c4. --- src/pages/docs/[...slug].astro | 65 +++++++++++----------------------- src/pages/docs/[slug].astro | 45 +++++++++++++++++++++++ 2 files changed, 66 insertions(+), 44 deletions(-) create mode 100644 src/pages/docs/[slug].astro diff --git a/src/pages/docs/[...slug].astro b/src/pages/docs/[...slug].astro index 3e1ea20..c333a81 100644 --- a/src/pages/docs/[...slug].astro +++ b/src/pages/docs/[...slug].astro @@ -1,55 +1,32 @@ --- // ------------------------------------ -// 目次・記事統合版ファイル +// ドキュメント本体を表示する用のファイル // ------------------------------------ -import { getCollection, getEntry, render } from "astro:content"; +import { getCollection, render } from "astro:content"; import Layout from "../../layouts/Layout.astro"; -const { slug } = Astro.params; +export async function getStaticPaths() { + const docs = await getCollection("docs"); -const metaData = await getEntry("metaData", `${slug}/meta`); - -let article; -let Content; -let filteredDocs = []; + return docs.map((doc) => { + return { + params: { slug: doc.id }, + props: { doc }, + }; + }); +} -if (metaData) { - filteredDocs = await getCollection("docs", ({ id }) => id.startsWith(`${slug}/`)); -} else { - article = await getEntry("docs", slug); +const { doc } = Astro.props; +const { Content } = await render(doc); - if (article) { - const rendered = await render(article); - Content = rendered.Content; - } -} +export const prerender = true; --- -{ - metaData ? ( - -

{metaData.data.categoryName} ドキュメント一覧

- -
- ) : ( - -

{article.data.title}

- {article.data.description &&

{article.data.description}

} -
- -
-
- ) -} + +

{doc.data.title}

+ {doc.data.description &&

{doc.data.description}

} +
+ +
+
diff --git a/src/pages/docs/[slug].astro b/src/pages/docs/[slug].astro new file mode 100644 index 0000000..3ff77f1 --- /dev/null +++ b/src/pages/docs/[slug].astro @@ -0,0 +1,45 @@ +--- +// ------------------------------------ +// 目次用のファイル +// ------------------------------------ +import { getCollection } from "astro:content"; + +import Layout from "../../layouts/Layout.astro"; + +export async function getStaticPaths() { + const metaDatas = await getCollection("metaData"); + const docs = await getCollection("docs"); + + // 重複の無いカテゴリ名を抽出 + return metaDatas.map((metaData) => { + const dirPath = metaData.id.split("/").slice(0, -1).join("/"); + const extractedDocs = docs.filter((doc) => doc.id.startsWith(`${dirPath}/`)); + return { + params: { slug: dirPath }, + props: { category: metaData.data.categoryName, docs: extractedDocs }, + }; + }); +} + +const { category, docs } = Astro.props; + +export const prerender = true; +--- + + +

{category} ドキュメント一覧

+ +
From bd35236786086f13e58636504180623e699f9748 Mon Sep 17 00:00:00 2001 From: ryosanhin <90621212+ryosanhin@users.noreply.github.com> Date: Thu, 1 Oct 2026 22:33:33 +0900 Subject: [PATCH 3/8] =?UTF-8?q?rename:=20=E3=83=95=E3=82=A1=E3=82=A4?= =?UTF-8?q?=E3=83=AB=E3=82=92=E7=A7=BB=E5=8B=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal-docs | 2 +- src/pages/docs/{ => articles}/[...slug].astro | 2 +- src/pages/docs/{[slug].astro => categories/[...slug].astro} | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename src/pages/docs/{ => articles}/[...slug].astro (93%) rename src/pages/docs/{[slug].astro => categories/[...slug].astro} (95%) diff --git a/internal-docs b/internal-docs index bcebd35..c8ba3f5 160000 --- a/internal-docs +++ b/internal-docs @@ -1 +1 @@ -Subproject commit bcebd35bc848aca0053f448c2287e2c92e59e3c8 +Subproject commit c8ba3f56b7e90a9227b93751cc898b859860d099 diff --git a/src/pages/docs/[...slug].astro b/src/pages/docs/articles/[...slug].astro similarity index 93% rename from src/pages/docs/[...slug].astro rename to src/pages/docs/articles/[...slug].astro index c333a81..4cc885b 100644 --- a/src/pages/docs/[...slug].astro +++ b/src/pages/docs/articles/[...slug].astro @@ -4,7 +4,7 @@ // ------------------------------------ import { getCollection, render } from "astro:content"; -import Layout from "../../layouts/Layout.astro"; +import Layout from "../../../layouts/Layout.astro"; export async function getStaticPaths() { const docs = await getCollection("docs"); diff --git a/src/pages/docs/[slug].astro b/src/pages/docs/categories/[...slug].astro similarity index 95% rename from src/pages/docs/[slug].astro rename to src/pages/docs/categories/[...slug].astro index 3ff77f1..1455fb3 100644 --- a/src/pages/docs/[slug].astro +++ b/src/pages/docs/categories/[...slug].astro @@ -4,7 +4,7 @@ // ------------------------------------ import { getCollection } from "astro:content"; -import Layout from "../../layouts/Layout.astro"; +import Layout from "../../../layouts/Layout.astro"; export async function getStaticPaths() { const metaDatas = await getCollection("metaData"); From 9563162f6756390115f8bfbb3dbe7a5760c7368d Mon Sep 17 00:00:00 2001 From: ryosanhin <90621212+ryosanhin@users.noreply.github.com> Date: Thu, 1 Oct 2026 23:12:18 +0900 Subject: [PATCH 4/8] =?UTF-8?q?change:=20=E8=A8=98=E4=BA=8B=E3=83=9A?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=81=A8=E7=9B=AE=E6=AC=A1=E3=83=9A=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E3=82=92=E5=88=A5=E3=81=AE=E3=83=95=E3=82=A1=E3=82=A4?= =?UTF-8?q?=E3=83=AB=E3=81=A7=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/docs/articles/[...slug].astro | 26 ++++++++------------- src/pages/docs/categories/[...slug].astro | 28 ++++++++--------------- src/pages/docs/index.astro | 2 +- 3 files changed, 21 insertions(+), 35 deletions(-) diff --git a/src/pages/docs/articles/[...slug].astro b/src/pages/docs/articles/[...slug].astro index 4cc885b..314c881 100644 --- a/src/pages/docs/articles/[...slug].astro +++ b/src/pages/docs/articles/[...slug].astro @@ -2,30 +2,24 @@ // ------------------------------------ // ドキュメント本体を表示する用のファイル // ------------------------------------ -import { getCollection, render } from "astro:content"; +import { getEntry, render } from "astro:content"; import Layout from "../../../layouts/Layout.astro"; -export async function getStaticPaths() { - const docs = await getCollection("docs"); +const { slug } = Astro.params; - return docs.map((doc) => { - return { - params: { slug: doc.id }, - props: { doc }, - }; - }); -} +const article = slug && await getEntry("docs", slug); -const { doc } = Astro.props; -const { Content } = await render(doc); +if (!article) { + return new Response(null, { status: 404 }); +} -export const prerender = true; +const { Content } = await render(article); --- - -

{doc.data.title}

- {doc.data.description &&

{doc.data.description}

} + +

{article.data.title}

+ {article.data.description &&

{article.data.description}

}
diff --git a/src/pages/docs/categories/[...slug].astro b/src/pages/docs/categories/[...slug].astro index 1455fb3..c0950ca 100644 --- a/src/pages/docs/categories/[...slug].astro +++ b/src/pages/docs/categories/[...slug].astro @@ -2,38 +2,30 @@ // ------------------------------------ // 目次用のファイル // ------------------------------------ -import { getCollection } from "astro:content"; +import { getCollection, getEntry } from "astro:content"; import Layout from "../../../layouts/Layout.astro"; -export async function getStaticPaths() { - const metaDatas = await getCollection("metaData"); - const docs = await getCollection("docs"); +const { slug } = Astro.params; - // 重複の無いカテゴリ名を抽出 - return metaDatas.map((metaData) => { - const dirPath = metaData.id.split("/").slice(0, -1).join("/"); - const extractedDocs = docs.filter((doc) => doc.id.startsWith(`${dirPath}/`)); - return { - params: { slug: dirPath }, - props: { category: metaData.data.categoryName, docs: extractedDocs }, - }; - }); +const metaData = await getEntry("metaData", `${slug}/meta`); + +if (!metaData) { + return new Response(null, { status: 404 }); } -const { category, docs } = Astro.props; +const docs = await getCollection("docs", ({ id }) => id.startsWith(`${slug}/`)); -export const prerender = true; --- - -

{category} ドキュメント一覧

+ +

{metaData.data.categoryName} ドキュメント一覧

    { docs.map((doc) => { return (
  • - + {doc.data.title} {doc.data.description &&

    {doc.data.description}

    }
    diff --git a/src/pages/docs/index.astro b/src/pages/docs/index.astro index 5cfbc3e..7b82396 100644 --- a/src/pages/docs/index.astro +++ b/src/pages/docs/index.astro @@ -27,7 +27,7 @@ metaDatas.map((metaData) => { entries.map((entry) => { return (
  • - {entry.categoryName} + {entry.categoryName}
  • ); }) From e821501a23aa742819906f5711779d958f128d42 Mon Sep 17 00:00:00 2001 From: ryosanhin <90621212+ryosanhin@users.noreply.github.com> Date: Thu, 1 Oct 2026 23:20:09 +0900 Subject: [PATCH 5/8] =?UTF-8?q?style:=20=E3=82=B3=E3=83=BC=E3=83=87?= =?UTF-8?q?=E3=82=A3=E3=83=B3=E3=82=B0=E3=82=B9=E3=82=BF=E3=82=A4=E3=83=AB?= =?UTF-8?q?=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/docs/articles/[...slug].astro | 2 +- src/pages/docs/categories/[...slug].astro | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pages/docs/articles/[...slug].astro b/src/pages/docs/articles/[...slug].astro index 314c881..6866581 100644 --- a/src/pages/docs/articles/[...slug].astro +++ b/src/pages/docs/articles/[...slug].astro @@ -8,7 +8,7 @@ import Layout from "../../../layouts/Layout.astro"; const { slug } = Astro.params; -const article = slug && await getEntry("docs", slug); +const article = slug && (await getEntry("docs", slug)); if (!article) { return new Response(null, { status: 404 }); diff --git a/src/pages/docs/categories/[...slug].astro b/src/pages/docs/categories/[...slug].astro index c0950ca..cedf78f 100644 --- a/src/pages/docs/categories/[...slug].astro +++ b/src/pages/docs/categories/[...slug].astro @@ -15,7 +15,6 @@ if (!metaData) { } const docs = await getCollection("docs", ({ id }) => id.startsWith(`${slug}/`)); - --- From 36772080e1bcc142a7ea743f8fda115f2a17b7c3 Mon Sep 17 00:00:00 2001 From: Yusuke4869 <67366917+Yusuke4869@users.noreply.github.com> Date: Fri, 2 Oct 2026 03:17:24 +0900 Subject: [PATCH 6/8] chore: fix submodule commit --- internal-docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal-docs b/internal-docs index c8ba3f5..bcebd35 160000 --- a/internal-docs +++ b/internal-docs @@ -1 +1 @@ -Subproject commit c8ba3f56b7e90a9227b93751cc898b859860d099 +Subproject commit bcebd35bc848aca0053f448c2287e2c92e59e3c8 From 1c94c1519f31fa776f9dad0388e64abc0e7a9c6b Mon Sep 17 00:00:00 2001 From: ryosanhin <90621212+ryosanhin@users.noreply.github.com> Date: Fri, 2 Oct 2026 15:05:55 +0900 Subject: [PATCH 7/8] =?UTF-8?q?move:=20=E3=83=95=E3=82=A1=E3=82=A4?= =?UTF-8?q?=E3=83=AB=E3=81=AE=E4=BD=8D=E7=BD=AE=E3=82=92=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/{docs => }/categories/[...slug].astro | 4 ++-- src/pages/docs/{articles => }/[...slug].astro | 2 +- src/pages/docs/index.astro | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) rename src/pages/{docs => }/categories/[...slug].astro (88%) rename src/pages/docs/{articles => }/[...slug].astro (92%) diff --git a/src/pages/docs/categories/[...slug].astro b/src/pages/categories/[...slug].astro similarity index 88% rename from src/pages/docs/categories/[...slug].astro rename to src/pages/categories/[...slug].astro index cedf78f..6913536 100644 --- a/src/pages/docs/categories/[...slug].astro +++ b/src/pages/categories/[...slug].astro @@ -4,7 +4,7 @@ // ------------------------------------ import { getCollection, getEntry } from "astro:content"; -import Layout from "../../../layouts/Layout.astro"; +import Layout from "../../layouts/Layout.astro"; const { slug } = Astro.params; @@ -24,7 +24,7 @@ const docs = await getCollection("docs", ({ id }) => id.startsWith(`${slug}/`)); docs.map((doc) => { return (
  • - + {doc.data.title} {doc.data.description &&

    {doc.data.description}

    }
    diff --git a/src/pages/docs/articles/[...slug].astro b/src/pages/docs/[...slug].astro similarity index 92% rename from src/pages/docs/articles/[...slug].astro rename to src/pages/docs/[...slug].astro index 6866581..b4ebc31 100644 --- a/src/pages/docs/articles/[...slug].astro +++ b/src/pages/docs/[...slug].astro @@ -4,7 +4,7 @@ // ------------------------------------ import { getEntry, render } from "astro:content"; -import Layout from "../../../layouts/Layout.astro"; +import Layout from "../../layouts/Layout.astro"; const { slug } = Astro.params; diff --git a/src/pages/docs/index.astro b/src/pages/docs/index.astro index 7b82396..ab91f20 100644 --- a/src/pages/docs/index.astro +++ b/src/pages/docs/index.astro @@ -27,7 +27,7 @@ metaDatas.map((metaData) => { entries.map((entry) => { return (
  • - {entry.categoryName} + {entry.categoryName}
  • ); }) From e34d3db285beef4e34626dabf73ac2e24a94d8e2 Mon Sep 17 00:00:00 2001 From: ryosanhin <90621212+ryosanhin@users.noreply.github.com> Date: Fri, 2 Oct 2026 23:00:25 +0900 Subject: [PATCH 8/8] =?UTF-8?q?change:=20lint=E3=82=A8=E3=83=A9=E3=83=BC?= =?UTF-8?q?=E3=81=8C=E5=87=BA=E3=81=AA=E3=81=84=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E7=84=A1=E8=A6=96=E3=81=99=E3=82=8B=E3=82=B3=E3=83=A1=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/docs/[...slug].astro | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/docs/[...slug].astro b/src/pages/docs/[...slug].astro index b4ebc31..ed69694 100644 --- a/src/pages/docs/[...slug].astro +++ b/src/pages/docs/[...slug].astro @@ -20,6 +20,7 @@ const { Content } = await render(article);

    {article.data.title}

    {article.data.description &&

    {article.data.description}

    } +