adding support for projects

This commit is contained in:
hamdy
2020-11-09 23:44:15 +02:00
parent 76f35389c2
commit 790c32dce7
5 changed files with 336 additions and 0 deletions

View File

@@ -27,6 +27,15 @@ module.exports = function (api) {
...options
};
}
if (options.internal.typeName === 'Project') {
options.countries = (typeof options.tags === 'string') ? options.tags.split(',').map(string => string.trim()) : options.tags;
options.cities = (typeof options.tags === 'string') ? options.tags.split(',').map(string => string.trim()) : options.tags;
options.author = (typeof options.author === 'string') ? options.author.split(',').map(string => string.trim()) : options.author;
return {
...options
};
}
})
api.createPages(async ({
@@ -68,4 +77,45 @@ module.exports = function (api) {
});
});
// api.createPages(async ({
// graphql,
// createPage
// }) => {
// // Use the Pages API here: https://gridsome.org/docs/pages-api
// const {
// data
// } = await graphql(`{
// allProject {
// edges {
// previous {
// id
// }
// next {
// id
// }
// node {
// id
// path
// }
// }
// }
// }
// `);
// data.allProject.edges.forEach(function (element) {
// console.log(element)
// createPage({
// path: element.node.path,
// component: './src/templates/Project.vue',
// context: {
// previousElement: (element.previous) ? element.previous.id : '##empty##',
// nextElement: (element.next) ? element.next.id : '##empty##',
// id: element.node.id
// }
// });
// });
// });
}