Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- exports.createPages = async function({ actions, graphql }) {
- const { data } = await graphql(`
- query {
- swapi {
- posts {
- title
- description
- created_at
- id
- }
- }
- }
- `)
- data.swapi.posts.forEach(post => {
- const slug = post.id
- actions.createPage({
- path: `/post/${slug}`,
- component: require.resolve(`./src/components/PostLayout.js`),
- context: { slug: slug },
- })
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement