Add an alt tag for the hero image in the blog example (#868)
* Add an alt tag for the hero image * pass along * Create heavy-pumas-cross.md
This commit is contained in:
parent
4b94fc9f2e
commit
4591c1f5ad
4 changed files with 10 additions and 4 deletions
5
.changeset/heavy-pumas-cross.md
Normal file
5
.changeset/heavy-pumas-cross.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
"@example/blog": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Add an alt tag for the hero image in the blog example
|
|
@ -8,14 +8,14 @@ export interface Props {
|
||||||
heroImage: string;
|
heroImage: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { title, author, publishDate, heroImage } = Astro.props;
|
const { title, author, publishDate, heroImage, alt } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
<div class="layout">
|
<div class="layout">
|
||||||
<article class="content">
|
<article class="content">
|
||||||
<div>
|
<div>
|
||||||
<header>
|
<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>
|
<p class="publish-date">{publishDate}</p>
|
||||||
<h1 class="title">{title}</h1>
|
<h1 class="title">{title}</h1>
|
||||||
<Author name="@FredKSchott" href="https://twitter.com/FredKSchott" />
|
<Author name="@FredKSchott" href="https://twitter.com/FredKSchott" />
|
||||||
|
|
|
@ -5,7 +5,7 @@ import BlogHeader from '../components/BlogHeader.astro';
|
||||||
import BlogPost from '../components/BlogPost.astro';
|
import BlogPost from '../components/BlogPost.astro';
|
||||||
|
|
||||||
const {content} = Astro.props;
|
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' }>
|
<html lang={ content.lang || 'en' }>
|
||||||
<head>
|
<head>
|
||||||
|
@ -15,7 +15,7 @@ const {title, description, publishDate, author, heroImage, permalink} = content;
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<BlogHeader />
|
<BlogHeader />
|
||||||
<BlogPost title={title} author={author} heroImage={heroImage} publishDate={publishDate}>
|
<BlogPost title={title} author={author} heroImage={heroImage} publishDate={publishDate} alt={alt}>
|
||||||
<slot />
|
<slot />
|
||||||
</BlogPost>
|
</BlogPost>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -4,6 +4,7 @@ description: "We're excited to announce Astro as a new way to build static websi
|
||||||
publishDate: 'Tuesday, June 8 2021'
|
publishDate: 'Tuesday, June 8 2021'
|
||||||
author: 'fred'
|
author: 'fred'
|
||||||
heroImage: '/social.jpg'
|
heroImage: '/social.jpg'
|
||||||
|
alt: 'Astro'
|
||||||
layout: '../../layouts/BlogPost.astro'
|
layout: '../../layouts/BlogPost.astro'
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue