Skip to content

Commit

Permalink
Add an alt tag for the hero image in the blog example (#868)
Browse files Browse the repository at this point in the history
* Add an alt tag for the hero image

* pass along

* Create heavy-pumas-cross.md
  • Loading branch information
stramel authored Jul 27, 2021
1 parent 4b94fc9 commit 4591c1f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/heavy-pumas-cross.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@example/blog": patch
---

Add an alt tag for the hero image in the blog example
4 changes: 2 additions & 2 deletions examples/blog/src/components/BlogPost.astro
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ export interface Props {
heroImage: string;
}
const { title, author, publishDate, heroImage } = Astro.props;
const { title, author, publishDate, heroImage, alt } = Astro.props;
---

<div class="layout">
<article class="content">
<div>
<header>
{heroImage && <img width="720" height="420" class="hero-image" loading="lazy" src={heroImage} />}
{heroImage && <img width="720" height="420" class="hero-image" loading="lazy" src={heroImage} alt={alt} />}
<p class="publish-date">{publishDate}</p>
<h1 class="title">{title}</h1>
<Author name="@FredKSchott" href="https://twitter.com/FredKSchott" />
Expand Down
4 changes: 2 additions & 2 deletions examples/blog/src/layouts/BlogPost.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import BlogHeader from '../components/BlogHeader.astro';
import BlogPost from '../components/BlogPost.astro';
const {content} = Astro.props;
const {title, description, publishDate, author, heroImage, permalink} = content;
const {title, description, publishDate, author, heroImage, permalink, alt} = content;
---
<html lang={ content.lang || 'en' }>
<head>
Expand All @@ -15,7 +15,7 @@ const {title, description, publishDate, author, heroImage, permalink} = content;

<body>
<BlogHeader />
<BlogPost title={title} author={author} heroImage={heroImage} publishDate={publishDate}>
<BlogPost title={title} author={author} heroImage={heroImage} publishDate={publishDate} alt={alt}>
<slot />
</BlogPost>
</body>
Expand Down
1 change: 1 addition & 0 deletions examples/blog/src/pages/posts/introducing-astro.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ description: "We're excited to announce Astro as a new way to build static websi
publishDate: 'Tuesday, June 8 2021'
author: 'fred'
heroImage: '/social.jpg'
alt: 'Astro'
layout: '../../layouts/BlogPost.astro'
---

Expand Down

1 comment on commit 4591c1f

@vercel
Copy link

@vercel vercel bot commented on 4591c1f Jul 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

astro-docs – ./docs

astro-docs-pikapkg.vercel.app
astro-docs.vercel.app
docs.astro.build
astro-docs-git-main-pikapkg.vercel.app

Please sign in to comment.