Astro has adjusted the markdown image syntax to use Astro’s Image component, so you can pass some parts of Google’s Lighthouse audit automatically.
<!-- This goes into Astro's Image component -->Unfortunately, because it uses Image directly, it doesn’t contain widths, formats, and other enhancements we’ve made along the way.
<img src="/_astro/penguin-3.ClS-zgCy_tIb6a.webp" alt="A very cool penguin!" loading="lazy" decoding="async" fetchpriority="auto" width="1588" height="1054"/>To include our enhancements, we need to use MDX. When we do this, we can import our custom Image component (or Splendid Astro’s Image component) and use it in the .mdx file.
Here’s a simple way to do this:
---title: Your Post---
import { Image } from '@splendidlabz/astro'
<Image src="..." alt="..." />We cover using MDX in more detail in Content Systems.
Welcome! Unfortunately, you don’t have access to this lesson. To get access, please purchase the course or enroll in Magical Dev School.
Unlock this lesson