Skip to content

Commit

Permalink
Add alt property in BlogPost interface (#862)
Browse files Browse the repository at this point in the history
  • Loading branch information
Renan04lima authored Sep 17, 2024
1 parent e7e1e06 commit 636f1d4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion blog/sections/Template.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default function Template({ post }: Props) {
excerpt = "Excerpt",
date,
image,
alt
} = post;

return (
Expand All @@ -32,7 +33,7 @@ export default function Template({ post }: Props) {
: ""}
</p>
{image && (
<img class="w-full rounded-2xl bg-cover" src={image} alt={title} />
<img class="w-full rounded-2xl bg-cover" src={image} alt={alt ?? title} />
)}
<div dangerouslySetInnerHTML={{ __html: content }} />
</div>
Expand Down
4 changes: 4 additions & 0 deletions blog/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ export interface BlogPost {
title: string;
excerpt: string;
image?: ImageWidget;
/**
* @title Alt text for the image
*/
alt?: string;
/**
* @widget blog
* @collection authors
Expand Down

0 comments on commit 636f1d4

Please sign in to comment.