So I am messing around with creating a markdown blog and for some reason I cannot get images to work.
Gatsby-config.js
plugins: [
'gatsby-plugin-image',
'gatsby-plugin-sharp',
'gatsby-transformer-sharp',
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'images',
path: `${__dirname}/src/images/`,
},
__key: 'images',
},
]
Images are stored in src/images
blogpost.md
---
title: New Provider
image: ../images/new-provider.jpg
imageMeta:
attribution:
attributionLink:
featured: false
---
Here is how I am querying the data
export const query = graphql`
query PostsByID($slug: String!) {
mdx(slug: { eq: $slug }) {
body
frontmatter {
title
authors
date
featured
image
tags
}
}
}
`;
And here is my img
element
<Img alt={title} fluid={image} key={title} />
// I tried this too
<img alt={title} src={image} />
When the page loads , I just see my alt text and in the console I see http://localhost:8000/images/new-provider.jpg