Gatsby - Link to images using an absolute path in Markdown

Viewed 471

I'm using Gatsby and gatsby-remark-images so I can link to images in markdown.

I'd really like to use an absolute path to images in the markdown, but I can't seem to get it working. For example, this first one doesn't work, but the second one does:

![Not working](/src/images/2017/04/ToString-Method-Added.png)
![Working](./ToString-Method-Added.png)

Here's my gatsby-config.js (I used the tutorial as the starting point):

module.exports = {
  siteMetadata: { title: `Pandas Eating Lots` },
  plugins: [
    {
      resolve: `gatsby-source-filesystem`,
      options: { name: `src`, path: `${__dirname}/src/` }
    },
    {
      resolve: `gatsby-plugin-manifest`,
      options: {
        name: "GatsbyJS",
        short_name: "GatsbyJS",
        start_url: "/",
        background_color: "#6b37bf",
        theme_color: "#6b37bf",
        display: "standalone"
      }
    },
    "gatsby-plugin-offline",
    `gatsby-plugin-react-helmet`,
    `gatsby-transformer-remark`,
    `gatsby-plugin-emotion`,
    `gatsby-plugin-sharp`,
    {
      resolve: `gatsby-transformer-remark`,
      options: {
        plugins: [
          {
            resolve: `gatsby-remark-images`,
            options: {
              // It's important to specify the maxWidth (in pixels) of
              // the content container as this plugin uses this as the
              // base for generating different widths of each image.
              maxWidth: 590
            }
          }
        ]
      }
    }
  ]
};

I've tried adding another gatsby-source-filesystem to /src/images but that didn't help.

Is what I'm trying to do possible, if so, what am I missing?

0 Answers
Related