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,
};

View file

@ -3,7 +3,7 @@ title: "Code Examples"
description: "Aurghhhhhh"
pubDate: 2022-07-08
tags:
- "Gaybo"
- "code"
---
```astro

View file

@ -3,7 +3,7 @@ title: "Image Examples"
description: "fug"
pubDate: 2024-07-08
tags:
- "Faggo"
- "code"
---
![Image](../../assets/cupcake.jpg)

View file

@ -3,7 +3,8 @@ title: This is an example Post
description: "Cheat Sheet for Markdown"
pubDate: 2022-07-08
tags:
- "Faggor"
- "code"
- "fortnite"
---
# Markdown Cheat Sheet

View file

@ -3,7 +3,8 @@ title: "Math Examples"
description: "REEEEEE"
pubDate: 2024-06-08
tags:
- "Gaybo"
- "code"
- "math"
---
Some simple mathematical expressions:

View file

@ -1,13 +0,0 @@
---
title: GwaGwa
description: This is a very very very very very very very very very very very very long description of a post
tags:
- "GwaGwa"
- "Gaming"
- "Urchin"
- "Fortnite"
---
Im actually going to blow up
I FUCKING HATE JAVASCRIPT

3
src/content/tags/code.md Normal file
View file

@ -0,0 +1,3 @@
---
name: Code
---

View file

@ -0,0 +1,3 @@
---
name: Fortnite
---

4
src/content/tags/math.md Normal file
View file

@ -0,0 +1,4 @@
---
name: "Math"
---
``