Markdown referencing markdown with Gatsby

An email sent by Queen Raae 👑 on January 14th, 2022

Hello there,

In yesterday's unauthorized and rum-fueled treasure hunts in the sharky waters around the Gatsby islands helping Mirjam we looked at how to use markdown for marketing pages.

YouTube Sceengrab

One of the tricks we covered is to reference a markdown file from the front matter of another markdown file.

---
sections:
  - title: About us
    md: ../about.md
---

It gives you access to the fully transformed markdown node through childMarkdownRemark.

query ExampleQuery {
  markdownRemark{
    frontmatter {
      sections {
        title
        md {
          childMarkdownRemark {
            html
          }
        }
      }
    }
  }
}

Kinda neat, right?

 
All the best,
Queen Raae

 
PS: I am a markdown aficionado, how about you? Would you like more markdown tips and tricks?

I send emails like this one to help you get the most out of Gatsby multiple times a week. Sign up to get them delivered to your inbox.