Skip to content

Commit

Permalink
feat: uses Astro’s built-in optimized asset support for author profil…
Browse files Browse the repository at this point in the history
…e images
  • Loading branch information
HiDeoo committed Jun 16, 2024
1 parent a84fdc4 commit 2baa625
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/starlight-blog/components/Author.astro
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
import { Image } from 'astro:assets'
import { getPathWithBase } from '../libs/page'
import type { StarlightBlogAuthor } from '../schema'
Expand All @@ -19,7 +21,7 @@ const pictureSrc = author.picture
---

<Element href={isLink ? author.url : undefined} class="author">
{pictureSrc && <img alt={author.name} src={pictureSrc} />}
{pictureSrc && <Image alt={author.name} loading="eager" src={pictureSrc} height={40} width={40} />}
<div class="text">
<div class="name">{author.name}</div>
{author.title && <div class="title">{author.title}</div>}
Expand Down

0 comments on commit 2baa625

Please sign in to comment.