Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const path = require('path');
- module.exports.createPages = async ({graphql, actions}) => {
- const { createPage } = actions;
- const artistTemplate = path.resolve('./src/templates/artist.js');
- const res = await graphql(`
- query {
- allContentfulArtist {
- nodes {
- name
- picture {
- file {url}
- }
- instagram
- youTube
- soundcloud
- spotify
- snapchat
- }
- }
- }
- `)
- res.data.allContentfulArtist.nodes.forEach(node => {
- createPage({
- component: artistTemplate,
- path: `/${node.name}`,
- context: {
- name: node.name
- }
- });
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement