fix: author link referencing name instead of slug (#2)
This commit is contained in:
commit
4371313050
2 changed files with 3 additions and 1 deletions
|
@ -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,
|
||||
|
|
|
@ -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"
|
||||
>
|
||||
|
|
Loading…
Add table
Reference in a new issue