diff --git a/app/BlogListing.tsx b/app/BlogListing.tsx
index 650bfa2..b04388b 100644
--- a/app/BlogListing.tsx
+++ b/app/BlogListing.tsx
@@ -2,7 +2,8 @@
import Link from "next/link";
import { useRouter } from "next/navigation";
-import { useEffect, useMemo, useState } from "react";
+import { useMemo, useState } from "react";
+import { formatDate } from "@/lib/utils";
import {
Briefcase,
CircleHelp,
@@ -55,27 +56,6 @@ interface BlogListingProps {
initialQuery?: string;
}
-const MONTHS = [
- "Jan",
- "Feb",
- "Mar",
- "Apr",
- "May",
- "Jun",
- "Jul",
- "Aug",
- "Sep",
- "Oct",
- "Nov",
- "Dec",
-] as const;
-
-function formatDate(iso: string): string {
- const d = new Date(iso);
- if (Number.isNaN(d.getTime())) return iso;
- return `${MONTHS[d.getUTCMonth()]} ${d.getUTCDate()}, ${d.getUTCFullYear()}`;
-}
-
/**
* Client-side blog listing - hero, search, type/category filters, and a
* sticky featured rail. Filter state is derived from props (URL) + local state.
@@ -95,10 +75,6 @@ export default function BlogListing({
PostCategory | undefined
>(initialCategory);
- useEffect(() => {
- setQuery(initialQuery ?? "");
- }, [initialQuery]);
-
const types = useMemo(
() => Array.from(new Set(posts.map((p) => p.type))),
[posts],
diff --git a/app/[slug]/page.tsx b/app/[slug]/page.tsx
index 4806b77..cfe21f5 100644
--- a/app/[slug]/page.tsx
+++ b/app/[slug]/page.tsx
@@ -13,6 +13,7 @@ import {
TYPE_LABELS,
CATEGORY_LABELS,
} from "@/lib/content";
+import { formatDate } from "@/lib/utils";
import { APP_URL, APP_CONFIG, SOURCE_EDIT_BASE } from "@/lib/constants";
import { cn } from "@/lib/utils";
import { SECTION_CONTAINER_CLASS } from "@/components/ui/Container";
@@ -91,28 +92,6 @@ export async function generateMetadata({
};
}
-const MONTHS = [
- "Jan",
- "Feb",
- "Mar",
- "Apr",
- "May",
- "Jun",
- "Jul",
- "Aug",
- "Sep",
- "Oct",
- "Nov",
- "Dec",
-] as const;
-
-/** Locale-independent so SSR and client HTML match. */
-function formatDate(iso: string): string {
- const d = new Date(iso);
- if (Number.isNaN(d.getTime())) return iso;
- return `${MONTHS[d.getUTCMonth()]} ${d.getUTCDate()}, ${d.getUTCFullYear()}`;
-}
-
/** Full article page - cover, prose body, tags, share, and related posts. */
export default async function BlogPostPage({ params }: PageProps) {
const { slug } = await params;
@@ -272,12 +251,18 @@ export default async function BlogPostPage({ params }: PageProps) {
)}
-
- {post.author}
-
+ {post.authorUrl ? (
+
+ {post.author}
+
+ ) : (
+
+ {post.author}
+
+ )}