-
-
Notifications
You must be signed in to change notification settings - Fork 2
fix: optimized the docs images #291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| --- | ||
| import { getImage } from 'astro:assets'; | ||
|
|
||
| interface Props { | ||
| /** Image import from src/assets/ — processed by Astro's image pipeline */ | ||
| image: ImageMetadata; | ||
| class?: string; | ||
| } | ||
|
|
||
| const { image, class: className } = Astro.props; | ||
|
|
||
| const optimized = await getImage({ | ||
| src: image, | ||
| format: 'webp', | ||
| quality: 80, | ||
| }); | ||
| --- | ||
|
|
||
| <div | ||
| class:list={['feature-visual', className]} | ||
| style={`background-image: url('${optimized.src}');`} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: The Suggested FixManually prepend the Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews. |
||
| > | ||
| <slot /> | ||
| </div> | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: The
getImage()function may not prepend thebasepath to image URLs, causing broken images in deployments with a non-root base path, such as PR previews.Severity: MEDIUM
Suggested Fix
Manually prepend the base path to the URL generated by
getImage(). The base path can be accessed viaimport.meta.env.BASE_URL. Ensure the final URL is correctly constructed before being used in the inline style.Prompt for AI Agent
Did we get this right? 👍 / 👎 to inform future reviews.