diff --git a/src/content/config.ts b/src/content/config.ts index 32019f4..996404e 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -53,4 +53,14 @@ const tags = defineCollection({ }), }) -export const collections = { blog, authors, tags } +// Slash pages will be rendered as top pages: +// e.g. `src/content/slash/Films.md` => `https://gu.illau.me/films` +const slash = defineCollection({ + type: 'content', + schema: z.object({ + title: z.string(), + description: z.string(), + }), +}) + +export const collections = { blog, authors, tags, slash } diff --git a/src/pages/[...slug].astro b/src/pages/[...slug].astro new file mode 100644 index 0000000..0801513 --- /dev/null +++ b/src/pages/[...slug].astro @@ -0,0 +1,34 @@ +--- +import { getCollection } from 'astro:content' +import RootLayout from '@/layouts/RootLayout.astro' + +export const getStaticPaths = async () => { + const pages = await getCollection('slash') + if (!pages) return [] + return pages.map((post) => ({ + params: { slug: post.slug }, + props: { post }, + })) +} + +const { title, description } = Astro.props.post.data +const { Content } = await Astro.props.post.render() +--- + + +
+
+

+ {title} +

+

+ {description} +

+
+
+ +
+
+