diff --git a/src/components/NotchedBox.astro b/src/components/NotchedBox.astro index 38d8766..a4576ee 100644 --- a/src/components/NotchedBox.astro +++ b/src/components/NotchedBox.astro @@ -1,13 +1,14 @@ --- interface Props { fillNotches: "left" | "right" | "both" | "none"; + color?: string; } -const { fillNotches = "none" } = Astro.props; +const { fillNotches = "none", color = "gold" } = Astro.props; --- -
+
diff --git a/src/content.config.ts b/src/content.config.ts index 6c6f38e..9f64d2c 100644 --- a/src/content.config.ts +++ b/src/content.config.ts @@ -14,6 +14,7 @@ const blog = defineCollection({ pubDate: z.coerce.date().optional(), updatedDate: z.coerce.date().optional(), heroImage: image().optional(), + tags: z.array(z.string()).optional(), }), }); diff --git a/src/content/blog/forge-of-god-greg-bear.md b/src/content/blog/forge-of-god-greg-bear.md index 8752100..a33aa16 100644 --- a/src/content/blog/forge-of-god-greg-bear.md +++ b/src/content/blog/forge-of-god-greg-bear.md @@ -2,6 +2,9 @@ title: "The Forge of God by Greg Bear" description: "A short review" pubDate: "Jul 18 2025" +tags: + - Sci-Fi + - Book Review --- [The Forge of God](https://en.wikipedia.org/wiki/The_Forge_of_God) by [Greg Bear](https://en.wikipedia.org/wiki/Greg_Bear) is a bit of an old book to be reviewing now. It was first published in 1987 and it's 2025 now. Did I pick it up without realizing this? Was a stricken with an acute case of nostalgia? Was I trapped in an abandoned house with nothing else to read? Dear reader, I assure you that nothing so exciting happened. I simply saw it on my shelf and decided to read it. I don't need any other reason that that. diff --git a/src/content/blog/i-forgot-to-use-ai.md b/src/content/blog/i-forgot-to-use-ai.md index bde0c9d..8ce34de 100644 --- a/src/content/blog/i-forgot-to-use-ai.md +++ b/src/content/blog/i-forgot-to-use-ai.md @@ -2,6 +2,10 @@ title: "I Forgot to Use AI On My Latest Project" description: "I forgot to use an LLM to assist on my latest coding project. I probably set the progress of humanity back many hours. But hey, I learned something along the way. What did I learn? That I'd rather not use an LLM on this project." pubDate: "Jun 26 2025" +tags: + - AI + - Tech + - Coding --- I forgot to use AI on my last project. All the tech bros are laughing at me right now. I'm sure in the time I wasted I could have launched a cloud-based passive-income app, but now I'll just have fun staying poor. I'll cry myself to sleep right after I get the satisfaction of learning something new and building something with my own mind. diff --git a/src/layouts/BlogList.astro b/src/layouts/BlogList.astro new file mode 100644 index 0000000..aaf087b --- /dev/null +++ b/src/layouts/BlogList.astro @@ -0,0 +1,140 @@ +--- +import NotchedBox from '../components/NotchedBox.astro'; +import RootLayout from '../layouts/RootLayout.astro'; +import { getCollection, type CollectionEntry } from 'astro:content'; +import FormattedDate from '../components/FormattedDate.astro'; +import { Image } from 'astro:assets'; + +interface Params { + selectedTag?: string | undefined; +} + +const { selectedTag } = Astro.props; + +function publishedOnly(p: CollectionEntry<'blog'>): p is (CollectionEntry<'blog'> & { data: { pubDate: Date }}) { + return p.data.pubDate !== undefined; +} + +const allPosts = (await getCollection('blog', publishedOnly)) + .sort( + (a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf(), + ); + +const tags = allPosts.flatMap(p => p.data.tags); + +const posts = + selectedTag + ? allPosts.filter(p => p.data.tags.includes(selectedTag)) + : allPosts; +--- + + + +
+ +
+
+ +
+
diff --git a/src/pages/blog/index.astro b/src/pages/blog/index.astro index 86d5f8d..98544d6 100644 --- a/src/pages/blog/index.astro +++ b/src/pages/blog/index.astro @@ -1,85 +1,5 @@ --- -import NotchedBox from '../../components/NotchedBox.astro'; -import RootLayout from '../../layouts/RootLayout.astro'; -import { getCollection, type CollectionEntry } from 'astro:content'; -import FormattedDate from '../../components/FormattedDate.astro'; -import { Image } from 'astro:assets'; - -function publishedOnly(p: CollectionEntry<'blog'>): p is (CollectionEntry<'blog'> & { data: { pubDate: Date }}) { - return p.data.pubDate !== undefined; -} - -const posts = (await getCollection('blog', publishedOnly)) - .sort( - (a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf(), - ); +import BlogList from '../../layouts/BlogList.astro'; --- - - -
- -
-
+ diff --git a/src/pages/blog/tag/[...tag].astro b/src/pages/blog/tag/[...tag].astro new file mode 100644 index 0000000..a0969ec --- /dev/null +++ b/src/pages/blog/tag/[...tag].astro @@ -0,0 +1,20 @@ +--- +import { type CollectionEntry, getCollection } from 'astro:content'; +import BlogList from '../../../layouts/BlogList.astro'; + +export async function getStaticPaths() { + const posts = await getCollection('blog'); + + const tags = posts.flatMap(p => p.data.tags); + + return tags.map((tag) => ({ + params: { tag: tag }, + props: { tag: tag }, + })); +} +type Props = { tag: string } + +const tag = Astro.props.tag; +--- + +