From 68899f130a69547eacdbec8dd9c2edbea485c3fa Mon Sep 17 00:00:00 2001 From: Nicholas Ly Date: Sun, 22 Sep 2024 15:51:16 -0500 Subject: [PATCH] fix: author link referencing name instead of slug --- src/lib/utils.ts | 2 ++ src/pages/blog/[...slug].astro | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/utils.ts b/src/lib/utils.ts index c07f950..8f1987d 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -28,6 +28,7 @@ export async function parseAuthors(authors: string[]) { try { const author = await getEntry('authors', slug) return { + slug, name: author?.data?.name || slug, avatar: author?.data?.avatar || '/static/logo.png', isRegistered: !!author, @@ -35,6 +36,7 @@ export async function parseAuthors(authors: string[]) { } catch (error) { console.error(`Error fetching author with slug ${slug}:`, error) return { + slug, name: slug, avatar: '/static/logo.png', isRegistered: false, diff --git a/src/pages/blog/[...slug].astro b/src/pages/blog/[...slug].astro index 9ea6dd3..e233e71 100644 --- a/src/pages/blog/[...slug].astro +++ b/src/pages/blog/[...slug].astro @@ -103,7 +103,7 @@ const authors = await parseAuthors(post.data.authors ?? []) /> {author.isRegistered ? (