After hours of googling, seem like slug are deprecated and replace with UID.. How do I properly replace with UID
const path = require("path")
exports.createPages = async ({ reporter, actions, graphql }) => {
const { createPage } = actions
const blogTemplate = path.resolve("src/pages/detail.js")
const result = await graphql(`
query MyQuery {
allPrismicPosts {
edges {
node {
id
slugs
}
}
}
}
`)
if (result.errors) {
reporter.panic(result.errors)
}
const posts = result.data.allPrismicPosts.edges
posts.forEach(({ node }) => {
createPage({
path: `/detail/${node.slugs[0]}/`,
component: blogTemplate,
context: {
slug: node.id,
},
})
})
}