diff --git a/src/content.config.ts b/src/content.config.ts
index 9eddd4f..c8e2a58 100644
--- a/src/content.config.ts
+++ b/src/content.config.ts
@@ -7,8 +7,17 @@ const blogs = defineCollection({
schema: z.object({
title: z.string(),
description: z.string(),
- year: z.number(),
- published_at: z.date(),
+ publishedAt: z.union([z.date(), z.string()]).transform((val) => {
+ if (val instanceof Date) return val;
+ return new Date(val);
+ }),
+ publication: z.string().optional(),
+ author: z.string().optional(),
+ // Optional fields to match documents structure
+ rkey: z.string().optional(),
+ cid: z.string().optional(),
+ // Keep year for backward compatibility if needed
+ year: z.number().optional(),
}),
});
diff --git a/src/data/blog/building-a-ttc-alerts-bot-with-threads-api.mdx b/src/data/blog/building-a-ttc-alerts-bot-with-threads-api.mdx
index 0d1161b..345bc39 100644
--- a/src/data/blog/building-a-ttc-alerts-bot-with-threads-api.mdx
+++ b/src/data/blog/building-a-ttc-alerts-bot-with-threads-api.mdx
@@ -2,7 +2,7 @@
title: Building a TTC service alert bot with the Threads API and TTC Live Alerts API
description: Going into detail about how I built a bot to report service updates for the TTC on Threads
year: 2024
-published_at: 2024-06-23
+publishedAt: 2024-06-23
---
The Threads team at Meta finally released an API to interact with the Threads platform. I've had this idea of creating a bot account that posts updates about the TTC since the API was announced. I'm happy to announce that I've "finished" this project today. In this post I'll talk about how I built it and how I found and figured out how the TTC alerts API worked.
diff --git a/src/data/blog/docker-for-frontend-developers.mdx b/src/data/blog/docker-for-frontend-developers.mdx
index 53d6dee..4a550a5 100644
--- a/src/data/blog/docker-for-frontend-developers.mdx
+++ b/src/data/blog/docker-for-frontend-developers.mdx
@@ -2,7 +2,7 @@
title: Docker for Frontend Developers
description: A short walkthrough on how to create an API
year: 2021
-published_at: 2021-03-17
+publishedAt: 2021-03-17
---
I'll be honest, it took me a while to understand what docker was and why/how one would even use it in a typical workflow. I've read the documentation months ago to understand the basics but never knew how I could apply it into my own workflow or projects until recently. That's when I started to use it wherever I could.
diff --git a/src/data/blog/give-angular-a-second-chance.mdx b/src/data/blog/give-angular-a-second-chance.mdx
index c79a030..0b2a866 100644
--- a/src/data/blog/give-angular-a-second-chance.mdx
+++ b/src/data/blog/give-angular-a-second-chance.mdx
@@ -2,7 +2,7 @@
title: Why I think Developers should give Angular 17 a serious try
description: If you're a developer that is new to Angular and its ecosystem, you should definitely take a minute to try their latest release
year: 2023
-published_at: 2023-12-15
+publishedAt: 2023-12-15
---
You've seen the memes, you've seen the angry github comments, you've seen the negative press. I'll be honest, I fell victim to the propaganda online. Was some of it warranted? Probably, but some of it was a bit overexaggerated in my opinion. Seriously, Angular is a really good framework and I think the release of Angular 17 will bring it back into the light and a serious option for building websites. I've only been through the documentation briefly and did the tutorial but there are some things I _really_ like.
diff --git a/src/data/blog/running-a-containerized-application-in-the-cloud.mdx b/src/data/blog/running-a-containerized-application-in-the-cloud.mdx
index 633a358..dce69a6 100644
--- a/src/data/blog/running-a-containerized-application-in-the-cloud.mdx
+++ b/src/data/blog/running-a-containerized-application-in-the-cloud.mdx
@@ -1,8 +1,9 @@
---
title: Running a containerized application in the cloud using AWS App Runner
description: Exploring the new AWS App Runner service
-published_at: 2021-05-19
+publishedAt: 2021-05-19
year: 2021
+publication: t
---
I've been pretty deep in the cloud space for a few weeks now, researching different topics related to system design and playing around with different AWS services. So far I've been playing around with containers and figuring out ways I could deploy a simple containerized application to the cloud without much fuss. I've found AWS Elastic Container Service and AWS Elastic Kubernetes Service (more on kubernetes in another blog post, I've been having fun learning about it) but those are more for managing clusters of containers than just being able to deploy something simple and small. I've also looked at AWS Elastic Beanstalk and while it is possible to deploy docker containers through that service I haven't had much luck doing it through the UI or the Elastic Beanstalk CLI.
diff --git a/src/data/blog/supabase-auth-with-remix-and-vite.mdx b/src/data/blog/supabase-auth-with-remix-and-vite.mdx
index 6d4d2b0..481d785 100644
--- a/src/data/blog/supabase-auth-with-remix-and-vite.mdx
+++ b/src/data/blog/supabase-auth-with-remix-and-vite.mdx
@@ -2,7 +2,7 @@
title: Add authentication to your Remix application with Supabase
description: Adding authentication to your remix app with Supabase has never been easier, this blog post will show you how to get up and running quickly
year: 2024
-published_at: 2024-03-08
+publishedAt: 2024-03-08
---
With Supabase now fully supporting doing authentication completely server-side, it has never been easier to take advantage of all of the features that it offers. We'll go through how to quickly spin up a Remix project and add supabase with authentication.
diff --git a/src/data/blog/type-safe-environment-variables-in-remix.mdx b/src/data/blog/type-safe-environment-variables-in-remix.mdx
index cce0b29..7420bed 100644
--- a/src/data/blog/type-safe-environment-variables-in-remix.mdx
+++ b/src/data/blog/type-safe-environment-variables-in-remix.mdx
@@ -2,7 +2,7 @@
title: Type-safe environment variables in your Remix application using t3-env
description: Quickly and easily add type-safety and runtime validation to your environment variables using the t3-env package.
year: 2024
-published_at: 2024-04-05
+publishedAt: 2024-04-05
---
There are many was you can get type-safe variables in your projects, I've tried a few but recently found the t3-env package which makes it even easier and comes with some nice features as well. I will quickly walk through how to set this up in a Remix project.
diff --git a/src/data/blog/what-im-going-to-be-learning-in-2022.mdx b/src/data/blog/what-im-going-to-be-learning-in-2022.mdx
index db7284a..5e2b127 100644
--- a/src/data/blog/what-im-going-to-be-learning-in-2022.mdx
+++ b/src/data/blog/what-im-going-to-be-learning-in-2022.mdx
@@ -1,7 +1,7 @@
---
title: What I'm going to be learning in the year 2022
description: Tech / frameworks / languages I'm focusing on in the new year
-published_at: 2021-12-15
+publishedAt: 2021-12-15
year: 2021
---
diff --git a/src/data/blog/you-dont-have-to-code-all-the-time.mdx b/src/data/blog/you-dont-have-to-code-all-the-time.mdx
index 1ed61fc..bccab68 100644
--- a/src/data/blog/you-dont-have-to-code-all-the-time.mdx
+++ b/src/data/blog/you-dont-have-to-code-all-the-time.mdx
@@ -1,7 +1,7 @@
---
title: You don't have to code all the time
description: Talking about burnout and how I recovered
-published_at: 2021-03-18
+publishedAt: 2021-03-18
year: 2021
---
diff --git a/src/pages/blogs/[blog].astro b/src/pages/blogs/[blog].astro
index f3c6760..18d39d5 100644
--- a/src/pages/blogs/[blog].astro
+++ b/src/pages/blogs/[blog].astro
@@ -1,25 +1,42 @@
---
import BlogLayout from "@layouts/BlogLayout.astro";
import { render } from "astro:content";
-import { type CollectionEntry, getCollection, getEntry } from "astro:content";
+import { getCollection, getEntry, type CollectionEntry } from "astro:content";
+
+export const prerender = true;
export async function getStaticPaths() {
const documents = await getCollection("documents");
- return documents.map((document) => ({
- params: { blog: document.id },
- props: document,
- }));
+ const blogs = await getCollection("blogs");
+
+ // Combine both collections for static paths
+ const allPosts = [
+ ...documents.map((document) => ({
+ params: { blog: document.id },
+ props: { collection: "documents" },
+ })),
+ ...blogs.map((blog) => ({
+ params: { blog: blog.id },
+ props: { collection: "blogs" },
+ })),
+ ];
+
+ return allPosts;
}
-type Props = CollectionEntry<"documents">;
+// Try to get the entry from both collections
+let entry: CollectionEntry<"documents"> | CollectionEntry<"blogs"> | undefined =
+ await getEntry("documents", Astro.params.blog);
-const document = await getEntry("documents", Astro.params.blog);
+if (!entry) {
+ entry = await getEntry("blogs", Astro.params.blog);
+}
-if (!document) {
+if (!entry) {
return Astro.rewrite("/404");
}
-const { Content } = await render(document);
+const { Content } = await render(entry);
---
-
+
diff --git a/src/pages/blogs/index.astro b/src/pages/blogs/index.astro
index 7f3779c..9d1e8c1 100644
--- a/src/pages/blogs/index.astro
+++ b/src/pages/blogs/index.astro
@@ -3,11 +3,28 @@ import Layout from "@layouts/Layout.astro";
import BlogPost from "@components/BlogPost.astro";
import { getCollection } from "astro:content";
-// const posts = (await getCollection("blogs")).sort(
-// (a, b) => b.data.published_at.valueOf() - a.data.published_at.valueOf(),
-// );
-
+const blogs = await getCollection("blogs");
const documents = await getCollection("documents");
+
+// Combine both collections and sort by publishedAt
+const allPosts = [
+ ...blogs.map((blog) => ({
+ ...blog,
+ data: {
+ ...blog.data,
+ // Ensure publishedAt is a Date object for consistent sorting
+ publishedAt: new Date(blog.data.publishedAt),
+ },
+ })),
+ ...documents.map((document) => ({
+ ...document,
+ data: {
+ ...document.data,
+ // Ensure publishedAt is a Date object for consistent sorting
+ publishedAt: new Date(document.data.publishedAt),
+ },
+ })),
+].sort((a, b) => b.data.publishedAt.valueOf() - a.data.publishedAt.valueOf());
---
Blog
{
- documents.map((document) => (
+ allPosts.map((post) => (
))
}
diff --git a/src/pages/index.astro b/src/pages/index.astro
index 625de61..3dc0bd2 100644
--- a/src/pages/index.astro
+++ b/src/pages/index.astro
@@ -6,6 +6,26 @@ import Link from "@components/Link.astro";
import { getCollection } from "astro:content";
const documents = await getCollection("documents");
const blogs = await getCollection("blogs");
+
+// Combine both collections and sort by publishedAt
+const allPosts = [
+ ...blogs.map((blog) => ({
+ ...blog,
+ data: {
+ ...blog.data,
+ publishedAt: new Date(blog.data.publishedAt),
+ },
+ })),
+ ...documents.map((document) => ({
+ ...document,
+ data: {
+ ...document.data,
+ publishedAt: new Date(document.data.publishedAt),
+ },
+ })),
+]
+ .sort((a, b) => b.data.publishedAt.valueOf() - a.data.publishedAt.valueOf())
+ .slice(0, 5); // Show only the 5 most recent
---