fix: cover image redirect to undefined (#29311)

fixes #29310

## Bug

- [x] Related issues linked using `fixes #29310`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes
This commit is contained in:
Reza Baharvand 2021-09-23 04:37:12 +05:30 committed by GitHub
parent 0d4e4e9092
commit 797dca5913
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,9 +20,13 @@ export default function CoverImage({ title, url, slug }) {
)
return (
<div className="sm:mx-0">
<Link href={`/posts/${slug}`}>
{slug ? <a aria-label={title}>{image}</a> : image}
</Link>
{slug ? (
<Link href={`/posts/${slug}`}>
<a aria-label={title}>{image}</a>
</Link>
) : (
image
)}
</div>
)
}