function registerMarkdownFiles(graphql, boundActionCreators)
{
    // lists all the markdown nodes with a slug field
    // then creates the page from it.
    return new Promise((resolve) =>
        graphql(`
        {
            allMarkdownRemark {
                edges {
                    node {
                        fields {
                            slug
                        }
                    }
                }
            }
        }
      `)
        .then(result =>
        {
            result.data.allMarkdownRemark.edges.forEach(({ node }) =>
            {
                boundActionCreators.createPage({
                    path: node.fields.slug,
                    component: path.resolve(`./src/templates/article.js`),
                    context: {
                        // Data passed to context is available in page queries as GraphQL variables.
                        slug: node.fields.slug
                    },
                })
            })
            resolve()
        }));
}
/**
 * Registers the markdown files as pages.
 * @param {Function} graphql Reference to the graphql function.
 * @param {Object} boundActionCreators Helper object
 */
Registers the markdown files as pages.
@param {Function} graphql Reference to the graphql function.
@param {Object} boundActionCreators Helper object
Registers the markdown files as pages . @param { Function } graphql Reference to the graphql function . @param { Object } boundActionCreators Helper object
function registerMarkdownFiles(graphql, boundActionCreators)
{
    return new Promise((resolve) =>
        graphql(`
        {
            allMarkdownRemark {
                edges {
                    node {
                        fields {
                            slug
                        }
                    }
                }
            }
        }
      `)
        .then(result =>
        {
            result.data.allMarkdownRemark.edges.forEach(({ node }) =>
            {
                boundActionCreators.createPage({
                    path: node.fields.slug,
                    component: path.resolve(`./src/templates/article.js`),
                    context: {
                        slug: node.fields.slug
                    },
                })
            })
            resolve()
        }));
}
function registerMarkdownFiles ( graphql , boundActionCreators ) { return new Promise ( ( resolve ) => graphql ( ` ` ) . then ( result => { result . data . allMarkdownRemark . edges . forEach ( ( { node } ) => { boundActionCreators . createPage ( { path : node . fields . slug , component : path . resolve ( ` ` ) , context : { slug : node . fields . slug } , } ) } ) resolve ( ) } ) ) ; }
Registers the markdown files as pages.
Registers the markdown files as pages .
// lists all the markdown nodes with a slug field // then creates the page from it. // Data passed to context is available in page queries as GraphQL variables.