I'm having an issue with my front matter image not getting processed. I have several collections; one is working to process the image, but the other is not. I don't know what I'm doing wrong, but I have verified:
- the path is correct
- I'm using the image helper in the schema correctly
- I have checked spelling over 40 times at this point
- If I put the image in
publicfolder and reference viaimage: /my-imageit works fine. - I've changed my
.mdxfile to.md(since the one that's working is plain ol' markdown) but that didn't do it.
I even put:
image: image().transform((image, ctx) => {
debugger;
console.log(image);
}),
In my schema for the working and non-working image. The debugger gets hit after runtime-assets.js is called in the working one, but in the non-working collection, it never gets hit. It seems to always treat it as a string. I have commented out the whole image: section of the schema and I still get the same error I awlays get:
15:59:08 [ERROR] [LocalImageUsedWrongly]
Image's andgetImage'ssrcparameter must be an imported image or an URL, it cannot be a string filepath. Received@images/projects/goals/my-image.png.
Hint:
If you want to use an image from yoursrcfolder, you need to either import it or if the image is coming from a content collection, use the image() schema helper https://docs.astro.build/en/guides/images/#images-in-content-collections. See https://docs.astro.build/en/guides/images/#src-required for more information on thesrcproperty.
Error reference:
https://docs.astro.build/en/reference/errors/local-image-used-wrongly/
Stack trace:
...