Skip to content
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

astro:assets cannot be used with Collections frontmatter data #7271

Closed
1 task
LexSwed opened this issue Jun 1, 2023 · 1 comment
Closed
1 task

astro:assets cannot be used with Collections frontmatter data #7271

LexSwed opened this issue Jun 1, 2023 · 1 comment

Comments

@LexSwed
Copy link

LexSwed commented Jun 1, 2023

What version of astro are you using?

2.5.6

Are you using an SSR adapter? If so, which one?

Vercel

What package manager are you using?

npm

What operating system are you using?

Mac

What browser are you using?

Chrome

Describe the Bug

After #7139 cover image in frontmatter will have all props of an imported image, including absolute src path, not allowing to combine it with astro:assets <Image> component.

This makes this part that covers how to use frontmatter images with <Image> incorrect.

 `Image`'s and `getImage`'s `src` parameter must be an imported image 
or an URL, it cannot be a filepath. Received 
`/@fs/project/sandbox/src/assets/cat.jpg?origWidth=640&origHeight=427&origFormat=jpg`.

Link to Minimal Reproducible Example

https://codesandbox.io/p/sandbox/cranky-violet-86he43?file=%2Fsrc%2Fpages%2Findex.astro%3A13%2C1

Participation

  • I am willing to submit a pull request for this issue.
@LexSwed
Copy link
Author

LexSwed commented Jun 1, 2023

Had incorrect usage of frontmatter, passing cover.src instead of just cover:

<Image src={post.data.cover} alt="a cat" />

@LexSwed LexSwed closed this as completed Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant