Tags and Filtering

Yeet projects, as they're identical to posts in every way but name
Add OpenGraph for SEO
Add Plugin prop to Layout to avoid loading unnecessary JS and CSS
This commit is contained in:
Michał Gdula 2024-05-28 19:01:57 +01:00
parent 745ac58045
commit 291552c340
21 changed files with 336 additions and 212 deletions

View file

@ -1,28 +1,17 @@
import { z, defineCollection } from "astro:content";
import { z, defineCollection, reference } from "astro:content";
const postsCollection = defineCollection({
const posts = defineCollection({
type: "content",
schema: z.object({
draft: z.boolean().optional().default(false),
title: z.string(),
description: z.string(),
pubDate: z.string().transform((str) => new Date(str)),
tags: z.array(z.string()),
tags: z.array(reference("tags")),
}),
});
const projectsCollection = defineCollection({
type: "content",
schema: z.object({
draft: z.boolean().optional().default(false),
title: z.string(),
description: z.string(),
pubDate: z.string().transform((str) => new Date(str)),
tags: z.array(z.string()),
}),
});
const certificatesCollection = defineCollection({
const certificates = defineCollection({
type: "data",
schema: z.object({
title: z.string(),
@ -33,8 +22,15 @@ const certificatesCollection = defineCollection({
}),
});
const tags = defineCollection({
type: "content",
schema: z.object({
name: z.string(),
})
})
export const collections = {
posts: postsCollection,
projects: projectsCollection,
certificates: certificatesCollection,
posts,
certificates,
tags,
};