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 { try {
const author = await getEntry('authors', slug) const author = await getEntry('authors', slug)
return { return {
slug,
name: author?.data?.name || slug, name: author?.data?.name || slug,
avatar: author?.data?.avatar || '/static/logo.png', avatar: author?.data?.avatar || '/static/logo.png',
isRegistered: !!author, isRegistered: !!author,
@ -35,6 +36,7 @@ export async function parseAuthors(authors: string[]) {
} catch (error) { } catch (error) {
console.error(`Error fetching author with slug ${slug}:`, error) console.error(`Error fetching author with slug ${slug}:`, error)
return { return {
slug,
name: slug, name: slug,
avatar: '/static/logo.png', avatar: '/static/logo.png',
isRegistered: false, isRegistered: false,

View file

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