How to connect the magic
See original GitHub issueNot really sure what is happening here. I am getting errors about queries i don’t really see… I know im doing something wrong but not realy sure what is happening under the hood. This is with markdown but it seems to magically add to my queries in some way that I cant see.
Modifying examples that are provided I have something like this right now
const path = require('path');
exports.createPages = ({ boundActionCreators, graphql }) => {
console.log('Create Pages');
const { createPage } = boundActionCreators;
const mdPageTemplate = path.resolve('src/templates/md.js');
return graphql(`
{
allMarkdownRemark(
sort: { order: DESC, fields: [frontmatter___date] }
limit: 1000
) {
edges {
node {
excerpt(pruneLength: 250)
html
id
frontmatter {
date
path
title
}
}
}
}
}
`).then(result => {
if (result.errors) {
return Promise.reject(result.errors);
}
result.data.allMarkdownRemark.edges.forEach(({ node }) => {
createPage({
path: node.frontmatter.path,
component: mdPageTemplate,
context: {}, // additional data can be passed via context
});
});
});
};
Then the template has something like this:
// eslint-disable-next-line
export const pageQuery = graphql`
query MarkdownPageByPath($path: String!) {
markdownRemark(frontmatter: { path: { eq: $path } }) {
html
frontmatter {
date(formatString: "MMMM DD, YYYY")
path
title
}
}
}
`;
This produces an error that it cant find the id. Not really sure why. I see the original queries the id but dont know how i can get it to pass said id into this and/or why this is happening when the original example looks like this.
The GraphQL query from /Users/bradennapier/Desktop/Dash OS/IDE/projects/whaleclub-scam/src/templates/md.js failed
Errors:
GraphQLError: Cannot read property 'id' of undefined
Query:
query MarkdownPageByPath(
$path: String!
) {
markdownRemark(frontmatter: {path: {eq: $path}}) {
html
frontmatter {
date(formatString: "MMMM DD, YYYY")
path
title
}
}
}
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:17 (6 by maintainers)
Top Results From Across the Web
Connect an Apple wireless accessory with Mac
Connect an Apple Wireless Keyboard, Magic Mouse, or Magic Trackpad with your Mac · On your Mac, choose Apple menu > System Settings,...
Read more >Magic Keyboard Bluetooth pairing
Pair your keyboard · Double click the Bluetooth icon in the Windows taskbar. If you can't see the Bluetooth icon, · Select Add...
Read more >How to Connect Magic Keyboard to a Mac - Lifewire
Tap Settings > Bluetooth > On > and choose your Magic Keyboard from Other Devices. If you've already paired your keyboard with a...
Read more >How To Connect The Magic Box To Your Car - Help Center
Plug the USB-C cord directly into the Magic Box. · Take the other end of the cord (USB-A) and plug it directly into...
Read more >7 Simple Practices to Connect With Intuitive Magic
All you need is a little bit of imagination. Surround yourself in a circle of stones, a bubble of light, a shield of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Deleting the
node_modules
folder and runningyarn install && yarn develop
again made the blog post show up.You need to remove your node_modules directory and reinstall. If that’s not working — you could also try running
npm rebuild sharp
.