news
This commit is contained in:
@@ -34,6 +34,17 @@ module.exports = function(api) {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
if (options.internal.typeName === 'News') {
|
||||
|
||||
options.tags = (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
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
if (options.internal.typeName === 'Project') {
|
||||
options.tags = (typeof options.tags === 'string') ? options.tags.split(',').map(string => string.trim()) : options.tags;
|
||||
options.countries = (typeof options.countries === 'string') ? options.countries.split(',').map(string => string.trim()) : options.countries;
|
||||
@@ -87,16 +98,6 @@ module.exports = function(api) {
|
||||
})
|
||||
})
|
||||
|
||||
api.createPages(({ createPage }) => {
|
||||
createPage({
|
||||
path: '/newsroom',
|
||||
component: './src/templates/NewsRoom.vue',
|
||||
context: {
|
||||
private: private
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
api.createPages(async({
|
||||
graphql,
|
||||
createPage
|
||||
@@ -136,4 +137,44 @@ module.exports = function(api) {
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
api.createPages(async({
|
||||
graphql,
|
||||
createPage
|
||||
}) => {
|
||||
// Use the Pages API here: https://gridsome.org/docs/pages-api
|
||||
const {
|
||||
data
|
||||
} = await graphql(`{
|
||||
allNews {
|
||||
edges {
|
||||
previous {
|
||||
id
|
||||
}
|
||||
next {
|
||||
id
|
||||
}
|
||||
node {
|
||||
id
|
||||
path
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`);
|
||||
|
||||
data.allNews.edges.forEach(function(element) {
|
||||
createPage({
|
||||
path: element.node.path,
|
||||
component: './src/templates/NewsPost.vue',
|
||||
context: {
|
||||
previousElement: (element.previous) ? element.previous.id : '##empty##',
|
||||
nextElement: (element.next) ? element.next.id : '##empty##',
|
||||
id: element.node.id
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user