1

I'm following the Gatsby tutorial in utilising its GraphQL data layer and there seems to be a mismatch between the commands they're outlining versus what's available in my own browser GraphiQL explorer.

Gatsby tutorial and their code snippet:

Under allMdx, open the nodes dropdown. Inside the frontmatter dropdown, you should see fields for all the keys you created in the frontmatter of your MDX files. Select the title and date fields. You can use the formatString argument on the date field to change the way your dates are displayed (see Syntax Hint below).

query MyQuery {
  allMdx {
    nodes {
      frontmatter {
        date
        title
      }
    }
  }
}

My own GraphiQL browser explorer:

query MyQuery {
  allMdx {
    nodes {
      frontmatter {
        datePublished
        name
      }
    }
  }
}

This is how it looks on my screen

Was there an update by the team at GraphQL? If that's the case, I can work with that. But when I try to apply the 'formatString' function, it simply doesn't work with the new 'datePublished' query. Any ideas?

How formatString appears on my screen

I've tried utilising the new terms but formatString isn't working. I've tried searching for any (new) documentation on it but can't find anything.

  • Just an update, I cannot find 'slug' as per the tutorial either.. I suspect the tutorial is outdated in it referencing queries from the transformer plugin 'gatsby-plugin-mdx'. [There was a migration from V3 to V4 where certain queries were deleted](https://www.gatsbyjs.com/plugins/gatsby-plugin-mdx/#extending-the-graphql-mdx-nodes) such as, '...timeToRead, rawBody, slug, headings, html, mdxAST, wordCount, fileAbsolutePath from the query result.' There is a [means](https://www.gatsbyjs.com/plugins/gatsby-plugin-mdx/#extending-the-graphql-mdx-nodes) of bringing those queries back. – BartTheProgrammer Jun 20 '23 at 04:56

0 Answers0