Gatsby Mdx frontmatter is empty

I have a mdx gatsby page with frontmatter defined.

---
title: About Me
path: /about
description: Some information about me.
---

# About Me
[Twitter](https://twitter.com/RainFire336)

I have configured a default layout in the gatsby-config.js:

{
  resolve: 'gatsby-plugin-mdx',
  options: {
    defaultLayouts: {
      default: require.resolve("./src/components/page-layout.tsx")
    },
    gatsbyRemarkPlugins: [
      'gatsby-remark-images',
      {
        resolve: 'gatsby-remark-prismjs',
        options: {
          showLineNumbers: true,
          prompt: {
            user: 'rain',
          },
        },
      },
    ],
  },
}

The layout tries to access the frontmatter using it’s props:

import React from 'react';
import { Layout } from './layout';
import { Card } from './card';
import { Metadata } from './metadata';

interface Props {
  children: React.ReactNode;
  uri: string;
  pageContext: { frontmatter: any };
}

export default function (p: Props) {
  const { children, uri, pageContext } = p;
  return (
    <Layout>
      <Metadata {...pageContext.frontmatter} url={uri} />
      <Card style={{ width: '50%' }}>{children}</Card>
    </Layout>
  );
}

The problem is that frontmatter is always an empty object:
Debugger with empty frontmatter object
So to form a question. How do I get access to my frontmatter?

186 thoughts on “Gatsby Mdx frontmatter is empty”

  1. Do you have a spam issue on this site; I also am a blogger, and I was curious about your situation;
    we have created some nice procedures and we are looking to exchange strategies with other folks, why not shoot me
    an email if interested.

    Reply
  2. Hey, I think your website might be having browser compatibility issues.
    When I look at your blog site in Safari, it looks fine
    but when opening in Internet Explorer, it has some overlapping.
    I just wanted to give you a quick heads up! Other then that, wonderful blog!

    Reply
  3. Hi there it’s me, I am also visiting this web site daily, this web page is truly fastidious and the visitors are actually sharing pleasant thoughts.

    Reply
  4. When some one searches for his essential thing,
    therefore he/she wishes to be available that in detail,
    therefore that thing is maintained over here.

    Reply
  5. Excellent blog here! Also your website loads up very fast!
    What host are you using? Can I get your affiliate link to your host?
    I wish my site loaded up as quickly as yours lol

    Reply
  6. I got this website from my buddy who shared with me
    about this web page and at the moment this time I am visiting this web page and
    reading very informative articles or reviews here.

    Reply
  7. Hello There. I found your blog the use of msn. That is an extremely neatly written article.
    I will make sure to bookmark it and return to read extra of your helpful information. Thank you for the post.
    I’ll certainly return.

    Reply
  8. With havin so much written content do you ever run into any problems of plagorism or copyright infringement?
    My blog has a lot of completely unique content I’ve either
    authored myself or outsourced but it seems a lot of it is popping it up all over the web
    without my authorization. Do you know any techniques to
    help stop content from being stolen? I’d really appreciate it.

    Reply
  9. I don’t even understand how I stopped up here,
    however I believed this submit used to be good. I don’t realize who you might be however definitely
    you are going to a well-known blogger in case you aren’t
    already. Cheers!

    Reply
  10. Hmm it looks like your site ate my first comment (it was super long) so I
    guess I’ll just sum it up what I wrote and say, I’m thoroughly enjoying
    your blog. I too am an aspiring blog writer but
    I’m still new to everything. Do you have any helpful hints for inexperienced blog writers?
    I’d certainly appreciate it.

    Reply
  11. After checking out a few of the blog articles on your website, I truly like your
    technique of writing a blog. I book-marked it to my bookmark site list and will be checking back
    in the near future. Please visit my website as well and let me know how you feel.

    Reply