dev_el
dev_el

Reputation: 2947

Showing images in markdown for gatsby

I am following the Working with images in markdown posts and pages tutorial for gatsby and installed the following plugins

My images are in the same directory as my Markdown files in src/content. But my posts are still without images. I suspect I have to change something in my src/templates/blog-post.js to show the images but am unsure of the next step. Can someone tell me what changes I need to make?

Github

Upvotes: 3

Views: 1328

Answers (1)

EliteRaceElephant
EliteRaceElephant

Reputation: 8162

In order to embed images in markdown you also need gatsby-remark-images. Run yarn add gatsby-remark-images or npm install --save gatsby-remark-images.

Add this to your gatsby-config.js:

    "gatsby-plugin-sharp",
    "gatsby-transformer-sharp",
    {
      resolve: `gatsby-transformer-remark`,
      options: {
        plugins: [
          {
            resolve: `gatsby-remark-images`,
            options: {
              maxWidth: 590,
            },
          },
        ],
      },
    },

Upvotes: 3

Related Questions