Remove unnessary links (#12159)

There is no need to link to the image we are already viewing and this is also considered an accessibility issue.
This commit is contained in:
Marcus Blättermann 2023-01-24 14:01:00 +01:00 committed by GitHub
parent 031f6c7b60
commit 9555e7aecf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,10 +88,16 @@ const Image = ({ src, alt, title, href, ...props }) => {
const markdownComponents = { code: InlineCode, p: Fragment, a: Link }
return (
<figure className="gatsby-resp-image-figure">
<Link className={linkClassNames} href={href ?? src} hidden forceExternal>
{/* eslint-disable-next-line @next/next/no-img-element */}
{href ? (
<Link className={linkClassNames} href={href} hidden forceExternal>
{/* eslint-disable-next-line @next/next/no-img-element */}
<img className={classes.image} src={src} alt={alt} width={650} height="auto" />
</Link>
) : (
/* eslint-disable-next-line @next/next/no-img-element */
<img className={classes.image} src={src} alt={alt} width={650} height="auto" />
</Link>
)}
{title && (
<figcaption className="gatsby-resp-image-figcaption">
<MarkdownToReact markdown={title} />