Fix archive issues, add archive listing page

This commit is contained in:
Angelos Chalaris
2019-08-19 10:02:32 +03:00
parent 26904954ab
commit f9656c18ac
5 changed files with 4384 additions and 4302 deletions

View File

@ -44,20 +44,24 @@ exports.createPages = ({ graphql, actions }) => {
const snippets = result.data.allMarkdownRemark.edges;
snippets.forEach((post, index) => {
if(post.node.fileAbsolutePath.indexOf('README') !== -1)
return;
if (post.node.fileAbsolutePath.indexOf(config.snippetArchivePath) === -1)
createPage({
path: `/snippet${post.node.fields.slug}`,
component: snippetPage,
context: {
slug: post.node.fields.slug,
scope: `./snippets`,
},
});
else
createPage({
path: `/snippet_archive${post.node.fields.slug}`,
path: `/archive${post.node.fields.slug}`,
component: snippetPage,
context: {
slug: post.node.fields.slug,
scope: `./snippets_archive`,
},
});
});