diff --git a/src/app/[lang]/article/[slug]/page.tsx b/src/app/[lang]/article/[slug]/page.tsx index 3c5fed60..d2feb7ce 100644 --- a/src/app/[lang]/article/[slug]/page.tsx +++ b/src/app/[lang]/article/[slug]/page.tsx @@ -40,7 +40,7 @@ export default async function Web({ params: { slug, lang } }: ArticlePageProps) imageUrl: image?.data?.url, publicationDate: publishedAt, title, - author: { name: author?.name ?? "Anonymous" }, + author: { name: author?.name ?? "Anonymous", imageUrl: author?.avatar?.data?.url }, tags, slug, }} diff --git a/src/components/ArticleCard/ArticleCard.tsx b/src/components/ArticleCard/ArticleCard.tsx index e6733d55..28e99575 100644 --- a/src/components/ArticleCard/ArticleCard.tsx +++ b/src/components/ArticleCard/ArticleCard.tsx @@ -32,7 +32,7 @@ type ArticleCardProps = { export const hygraphArticleToCardProps = (article: { tags: string[] title: string - author?: { name: string } | null + author?: { name: string; avatar?: { data: { url: string } } | undefined | null } | null image?: { data: { url: string }; description?: { text: string } | undefined | null } | null publishedAt?: string content?: { raw: RichTextContent } | null @@ -44,7 +44,7 @@ export const hygraphArticleToCardProps = (article: { imageAlt: article.image?.description?.text, title: article?.title, content: article?.content, - author: { name: article?.author?.name ?? "Anonymous" }, + author: { name: article?.author?.name ?? "Anonymous", imageUrl: article?.author?.avatar?.data?.url }, publicationDate: article?.publishedAt ? article.publishedAt : null, slug: article?.slug, } diff --git a/src/components/ArticleCard/ArticlePublishDetails.tsx b/src/components/ArticleCard/ArticlePublishDetails.tsx index a619b308..27a80609 100644 --- a/src/components/ArticleCard/ArticlePublishDetails.tsx +++ b/src/components/ArticleCard/ArticlePublishDetails.tsx @@ -46,8 +46,18 @@ export function ArticlePublishDetails({

|

)} -

{author}

- {imageUrl && author} +
+

{author}

+ {imageUrl && ( + author + )} +
) } diff --git a/src/components/RecentArticles/RecentArticles.tsx b/src/components/RecentArticles/RecentArticles.tsx index 557edd62..3e597276 100644 --- a/src/components/RecentArticles/RecentArticles.tsx +++ b/src/components/RecentArticles/RecentArticles.tsx @@ -22,7 +22,7 @@ export async function RecentArticles({ title }: RecentArticlesProps) { diff --git a/src/components/Search/SearchDialog.tsx b/src/components/Search/SearchDialog.tsx index 167fc645..c6f3534f 100644 --- a/src/components/Search/SearchDialog.tsx +++ b/src/components/Search/SearchDialog.tsx @@ -92,7 +92,11 @@ function CustomHit({ hit, lang }: { hit: ArticleHit; lang: Locale }) { />
{hit.tags?.map((tag) => { - return {tag} + return ( + + {tag} + + ) })}
diff --git a/src/lib/queries/articles.ts b/src/lib/queries/articles.ts index 1b403591..669161fa 100644 --- a/src/lib/queries/articles.ts +++ b/src/lib/queries/articles.ts @@ -35,6 +35,11 @@ export const getRecentArticlesWithMainQuery = graphql(` id author { name + avatar { + data { + url + } + } } publishedAt updatedAt @@ -58,6 +63,11 @@ export const getRecentArticlesWithMainQuery = graphql(` id author { name + avatar { + data { + url + } + } } publishedAt updatedAt @@ -88,6 +98,11 @@ export const getRecentArticlesQuery = graphql(` id author { name + avatar { + data { + url + } + } } publishedAt updatedAt @@ -123,6 +138,11 @@ export const getArticleRecommendedArticlesQuery = graphql(` publishedAt author { name + avatar { + data { + url + } + } } image { description { @@ -156,6 +176,11 @@ export const getArticleBySlugQuery = graphql(` author { id name + avatar { + data { + url + } + } } content { raw @@ -218,6 +243,11 @@ export const listArticlesBySlugQuery = graphql(` author { id name + avatar { + data { + url + } + } } tags } @@ -243,6 +273,11 @@ export const listArticlesByCategoryQuery = graphql(` } author { name + avatar { + data { + url + } + } } publishedAt tags diff --git a/src/lib/queries/components.ts b/src/lib/queries/components.ts index 73c918c4..02ae4575 100644 --- a/src/lib/queries/components.ts +++ b/src/lib/queries/components.ts @@ -66,6 +66,11 @@ export const getHomepageQuery = graphql(` id author { name + avatar { + data { + url + } + } } publishedAt locale @@ -94,6 +99,11 @@ export const getHomepageQuery = graphql(` id author { name + avatar { + data { + url + } + } } publishedAt locale