You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to display featuredImages within my blog-posts.
My frontmatter looks like this:
---
title: My pst with a feature image
date: "2021-05-16T09:45:00.000Z"
description: "Some cool post with a feature image"
tags: [demo]
featuredImage: "feature.png"
---
The index.md and the feature.png are siblings in the same directory. I'm using this query:
{
"data": {
"markdownRemark": {
"id": "f73a3644-493c-5cc4-8a5d-f749db898954",
"frontmatter": {
"title": "My pst with a feature image",
"date": "16. Mai 2021",
"dateIso": "2021-05-16",
"description": "Some cool post with a feature image",
"tags": [
"demo"
],
"featuredImage": {
"childImageSharp": null
}
}
}
},
"extensions": {}
}
This is not what I expected. I would have expected to get my image-data here ... likewise I'm getting this message on the console (running gatsby in development mode):
warn You can't use childImageSharp together with undefined.undefined — use publicURL instead. The childImageSharp portion of the query in this file will return null:
undefined
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I want to display featuredImages within my blog-posts.
My frontmatter looks like this:
The index.md and the feature.png are siblings in the same directory. I'm using this query:
and I'm getting this result in the GraphiQL:
This is not what I expected. I would have expected to get my image-data here ... likewise I'm getting this message on the console (running gatsby in development mode):
I'm using these packages:
I also extended the
Frontmatter
type in mygatsby-node.js
, so that featureImage would be recognized as a file:And finally I setup the
gatsby-source-filesystem
plugin to resolve two paths (as I have posts and pages):What might I be missing?
Beta Was this translation helpful? Give feedback.
All reactions