diff --git a/src/content.config.ts b/src/content.config.ts new file mode 100644 index 0000000..6e97e59 --- /dev/null +++ b/src/content.config.ts @@ -0,0 +1,15 @@ +import { defineCollection, z } from "astro:content"; +import { glob } from "astro/loaders"; + +const blog = defineCollection({ + loader: glob({ base: "./src/content/posts", pattern: "**/*.{md,mdx}" }), + schema: z.object({ + title: z.string(), + description: z.string().optional(), + pubDate: z.coerce.date(), + modifiedDate: z.coerce.date().optional(), + wantsPanel: z.boolean().default(true) + }) +}); + +export const collections = { blog }; \ No newline at end of file diff --git a/src/layouts/MainLayout.astro b/src/layouts/MainLayout.astro index 3471e98..51b3fc2 100644 --- a/src/layouts/MainLayout.astro +++ b/src/layouts/MainLayout.astro @@ -1,5 +1,12 @@ --- +import Panel from "./Panel.astro"; import "../styles/global.scss"; +import { getCollection } from "astro:content"; + +const { title } = Astro.props; +const pageTitle = title || "FoxGirlRiley's shitty website | Bwaaa 🎺"; + +const hasPosts = (await getCollection("blog")).length > 0; --- @@ -8,9 +15,19 @@ import "../styles/global.scss"; -