Want to create pages for multiple components and paths using createPages

datoCMSData.map((blogData, ind) => {
createPage({
path: /blog/${datoCMSData[ind].id},
path: /writing/${datoCMSData[ind].id} ,
component: require.resolve(./src/pages/blog/blog-template.jsx),
component: require.resolve(./src/pages/writing/writing-sample.jsx),
// How can i do this?
context: { blogData, datoCMSData },
})
})

Hello @sohaibahmed and welcome to the community!

Just as we query the Dato information in the example here, that uses dynamic paths to create said pages: gatsby-blog-demo/{DatoCmsPost.slug}.js at main · datocms/gatsby-blog-demo · GitHub

You can do the same queries and plug their values into the createPages function call instead of plugin them in the react component.

If you have any doubts on how to query gatsby information using gatsby we have a step by step guide right here: https://www.gatsbyjs.com/plugins/gatsby-source-datocms/#how-to-query