Cannot query field "childMdx" on type "File"
heitorlessa opened this issue Β· comments
Hello,
It's my first time trying gatsby because of this wonderful theme, however I couldn't get it work due to this error:
Cannot query field "childMdx" on type "File".
Let me know if there's any file/content you want me to share - I'm mostly trying to get a hello-world working at this stage.
Thank you
Hey @heitorlessa, thanks for trying the theme out. I recently merged #96 which attempts to make it easier to understand how to get the theme up and running. One of the things I did was add a "required" column to the options table and try to reduce the number of required options to the bare minimum.
Regarding your issue, at the moment the theme has logic in it that expects both Markdown and MDX to exist. One of the things that I was hoping to do in this PR was remove this constraint, but it proved to be too difficult and I'm going to come back to it later.
For now, I'd recommend you just create a dummy MDX file with title
and description
frontmatter so that Gatsby can create the types and fields it needs to in it's GraphQL schema. I put together an example of a smallest-possible-config implementation of the theme for your reference. Notice I've got an index.md
and a dummy.mdx
file in the content
directory (the default value for the contentDir
option).
That's awesome to hear -- I will try them tomorrow and ping back here
Just tested and that worked beautifully! Had some issues with siteMetadata but copied from my previous config.
The only piece I couldn't figure out from the docs is - How do I remove Discuss on Spectrum/Edit on GitHub/Launch Graph Manager
as I don't use it?
Thanks again
If you're using the latest version of the theme (4.0.3 at this time), you should see no GitHub or Spectrum links as long as you don't pass githubRepo
or spectrumHandle
options to the theme when you configure it.
To remove the "Launch Graph Manager" button, simply shadow the header-button.js
file with a function that returns null
.
// src/gatsby-theme-apollo-docs/components/header-button.js
export default () => null;
I've updated the example with the latest version of the Gatsby theme and implemented the HeaderButton
shadowing technique that I mentioned!
One small correction - Edit on GitHub
still appears even when githubRepo
key isn't present; same behaviour with your Sandbox example.
@heitorlessa I'm not seeing the "Edit on GitHub" link in the codesandbox anymore: https://bywp2.sse.codesandbox.io/
This was an issue at one point after publishing v4 of the theme, but I fixed it in version 4.0.2 with this commit. Try upgrading your theme version with npm install gatsby-theme-apollo-docs@latest
to get the fix! π
Hi
I had the same problem, and tried building the exmample you give.
I did the following
- added content/components/dummy.mdx
- added content/dummy.mdx
- added conten t.index.md
- add gatsby-theme-apollo-docs/components\heaader-button.js
- copied gatsby-config.js as is
This failed with error #85923
Cannot query field "description" on type "MdxFrontmatter".
Did I miss something out?
Thanks
THe version I'm using is
"dependencies": {
"gatsby": "^2.29.3",
"gatsby-theme-apollo-docs": "^4.5.12",
"react": "^17.0.1",
"react-dom": "^17.0.1"
}
@yonatanLehman make sure you add title
and description
frontmatter in both of your mdx and md files! Let me know if that works.
---
title: test title
description: this is a description
---