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