fix: author link referencing name instead of slug

This commit is contained in:
Nicholas Ly 2024-09-22 15:51:16 -05:00
parent a794b56ece
commit 68899f130a
2 changed files with 3 additions and 1 deletions

View file

@ -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,

View file

@ -103,7 +103,7 @@ const authors = await parseAuthors(post.data.authors ?? [])
/>
{author.isRegistered ? (
<Link
href={`/authors/${author.name}`}
href={`/authors/${author.slug}`}
underline
class="text-foreground"
>