From 01f64c14ccfc77919eae9a5226c74d40e533812a Mon Sep 17 00:00:00 2001 From: Korbs Date: Thu, 24 Oct 2024 22:05:52 -0400 Subject: [PATCH] Fix Docs --- src/components/docs/sidebar.astro | 4 +- src/content/config.ts | 8 ++ src/content/{ => docs}/minpluto/API.mdx | 0 .../{ => docs}/minpluto/compatibility.mdx | 0 .../{ => docs}/minpluto/introduction.mdx | 0 .../{ => docs}/minpluto/requirements.mdx | 0 .../{ => docs}/minpluto/self-hosting.mdx | 0 src/content/{ => docs}/minpluto/support.mdx | 0 src/content/{ => docs}/penpot-desktop/faq.mdx | 0 .../{ => docs}/penpot-desktop/instance.mdx | 0 .../penpot-desktop/introduction.mdx | 0 .../{ => docs}/penpot-desktop/offline-use.mdx | 0 .../{ => docs}/penpot-desktop/progress.mdx | 0 src/content/{ => docs}/zorn/introduction.mdx | 0 src/layouts/Document.astro | 39 +------- src/pages/docs/[...slug].astro | 91 +++++++++++++++++++ 16 files changed, 105 insertions(+), 37 deletions(-) create mode 100644 src/content/config.ts rename src/content/{ => docs}/minpluto/API.mdx (100%) rename src/content/{ => docs}/minpluto/compatibility.mdx (100%) rename src/content/{ => docs}/minpluto/introduction.mdx (100%) rename src/content/{ => docs}/minpluto/requirements.mdx (100%) rename src/content/{ => docs}/minpluto/self-hosting.mdx (100%) rename src/content/{ => docs}/minpluto/support.mdx (100%) rename src/content/{ => docs}/penpot-desktop/faq.mdx (100%) rename src/content/{ => docs}/penpot-desktop/instance.mdx (100%) rename src/content/{ => docs}/penpot-desktop/introduction.mdx (100%) rename src/content/{ => docs}/penpot-desktop/offline-use.mdx (100%) rename src/content/{ => docs}/penpot-desktop/progress.mdx (100%) rename src/content/{ => docs}/zorn/introduction.mdx (100%) create mode 100644 src/pages/docs/[...slug].astro diff --git a/src/components/docs/sidebar.astro b/src/components/docs/sidebar.astro index 3ee59b6..39bf2b7 100644 --- a/src/components/docs/sidebar.astro +++ b/src/components/docs/sidebar.astro @@ -6,13 +6,13 @@ import {ArrowDownCircle} from "@iconoir/vue"
{Project}
- +
diff --git a/src/content/config.ts b/src/content/config.ts new file mode 100644 index 0000000..0ff298c --- /dev/null +++ b/src/content/config.ts @@ -0,0 +1,8 @@ +import { defineCollection, z } from 'astro:content'; + +const docs = defineCollection({ + type: 'content', + schema: z.object({title: z.string()}), +}); + +export const Documents = { docs } \ No newline at end of file diff --git a/src/content/minpluto/API.mdx b/src/content/docs/minpluto/API.mdx similarity index 100% rename from src/content/minpluto/API.mdx rename to src/content/docs/minpluto/API.mdx diff --git a/src/content/minpluto/compatibility.mdx b/src/content/docs/minpluto/compatibility.mdx similarity index 100% rename from src/content/minpluto/compatibility.mdx rename to src/content/docs/minpluto/compatibility.mdx diff --git a/src/content/minpluto/introduction.mdx b/src/content/docs/minpluto/introduction.mdx similarity index 100% rename from src/content/minpluto/introduction.mdx rename to src/content/docs/minpluto/introduction.mdx diff --git a/src/content/minpluto/requirements.mdx b/src/content/docs/minpluto/requirements.mdx similarity index 100% rename from src/content/minpluto/requirements.mdx rename to src/content/docs/minpluto/requirements.mdx diff --git a/src/content/minpluto/self-hosting.mdx b/src/content/docs/minpluto/self-hosting.mdx similarity index 100% rename from src/content/minpluto/self-hosting.mdx rename to src/content/docs/minpluto/self-hosting.mdx diff --git a/src/content/minpluto/support.mdx b/src/content/docs/minpluto/support.mdx similarity index 100% rename from src/content/minpluto/support.mdx rename to src/content/docs/minpluto/support.mdx diff --git a/src/content/penpot-desktop/faq.mdx b/src/content/docs/penpot-desktop/faq.mdx similarity index 100% rename from src/content/penpot-desktop/faq.mdx rename to src/content/docs/penpot-desktop/faq.mdx diff --git a/src/content/penpot-desktop/instance.mdx b/src/content/docs/penpot-desktop/instance.mdx similarity index 100% rename from src/content/penpot-desktop/instance.mdx rename to src/content/docs/penpot-desktop/instance.mdx diff --git a/src/content/penpot-desktop/introduction.mdx b/src/content/docs/penpot-desktop/introduction.mdx similarity index 100% rename from src/content/penpot-desktop/introduction.mdx rename to src/content/docs/penpot-desktop/introduction.mdx diff --git a/src/content/penpot-desktop/offline-use.mdx b/src/content/docs/penpot-desktop/offline-use.mdx similarity index 100% rename from src/content/penpot-desktop/offline-use.mdx rename to src/content/docs/penpot-desktop/offline-use.mdx diff --git a/src/content/penpot-desktop/progress.mdx b/src/content/docs/penpot-desktop/progress.mdx similarity index 100% rename from src/content/penpot-desktop/progress.mdx rename to src/content/docs/penpot-desktop/progress.mdx diff --git a/src/content/zorn/introduction.mdx b/src/content/docs/zorn/introduction.mdx similarity index 100% rename from src/content/zorn/introduction.mdx rename to src/content/docs/zorn/introduction.mdx diff --git a/src/layouts/Document.astro b/src/layouts/Document.astro index 4958a61..72c889f 100644 --- a/src/layouts/Document.astro +++ b/src/layouts/Document.astro @@ -9,53 +9,22 @@ import Default from "@layouts/Default.astro"; // Components import Sidebar from "@components/docs/sidebar.astro"; - -// Hightlight Active Project -if (ProjectCollection === 'minpluto') { - var Hightlight_MinPluto = true -} -if (ProjectCollection === 'zorn') { - var Hightlight_Zorn = true -} -if (ProjectCollection === 'penpot-desktop') { - var Hightlight_Penpot = true -} ---

SudoVanilla Documentations

-
- {Hightlight_MinPluto ? - MinPluto - : - MinPluto - } - {Hightlight_Zorn ? - Zorn Player - : - Zorn Player - } - {Hightlight_Penpot ? - Penpot Desktop - : - Penpot Desktop - } +
- - - -
+
diff --git a/src/pages/docs/[...slug].astro b/src/pages/docs/[...slug].astro new file mode 100644 index 0000000..6a80344 --- /dev/null +++ b/src/pages/docs/[...slug].astro @@ -0,0 +1,91 @@ +--- +// Icons +import {ServerConnection,PeaceHand, SlashSquare, ClipboardCheck} from "@iconoir/vue"; +import {ServerConnection,PeaceHand, QuestionMark, WifiOff, DownloadCircle, ShieldAlert, ChatBubble} from "@iconoir/vue"; + +// Get Colletion and Slug +import { getCollection, getEntry } from "astro:content"; +import Document from "@layouts/Document.astro" + +const { slug } = Astro.params; +if (!slug) throw new Error("Slug not found"); +const post = await getEntry("docs", slug); + +if (!post) throw new Error("No post found for this slug"); +const { Content } = await post.render(); + +/// Generate static pages +export async function getStaticPaths() { + const posts = await getCollection("docs"); + return posts.map((post) => ({ params: { slug: post.slug } })); +} +export const prerender = true; + +// Components +import Sidebar from "@components/docs/sidebar.astro"; +--- + + + + \ No newline at end of file