WebsiteFluffy/src/content/posts/2024_05_28-Astro_is_hard.mdx
Fluffy-Bean 54e79beb30 Add MDX support
Start writing a blog and clean up/hide tester stuff
2024-05-28 21:36:29 +01:00

34 lines
929 B
Text

---
title: Astro is hard....
description: Arugh
pubDate: 2024-05-28
tags:
- astro
- typescript
---
import Note from "../../components/Note.astro";
<Note text="I have no clue what I'm doing :3" />
- I've been trying to learn typescript through trying astro
- Astro is hard, due to all the issues I've encountered
```typescript
export async function getTagsBySlug(postTags: string[]): Promise<CollectionEntry<"tags">[]> {
// Collect all the tags from collections
const allTags: CollectionEntry<"tags">[] = await getCollection("tags");
// Loop through all the tags in a post and the tags in the collections
// To see if they match, if they do we'll return them
const tags: CollectionEntry<"tags">[] = [];
postTags.forEach((postTag) => {
allTags.forEach((allTag) => {
if (allTag.slug === postTag) tags.push(allTag);
});
});
// Yeet
return tags;
}
```