Add scambox

This commit is contained in:
Kevin Kandlbinder 2021-11-05 22:29:08 +00:00 committed by GitHub
parent 31fd2e5755
commit 5c17277817
16 changed files with 611 additions and 97 deletions

View file

@ -6,6 +6,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
const { createPage } = actions;
const projectTemplate = path.resolve(`src/templates/project.js`);
const scamboxTemplate = path.resolve(`src/templates/scamboxPost.js`);
const result = await graphql(`
query AllPagesQuery {
@ -15,6 +16,23 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
urlname
}
}
scambox: allFile(
filter: { sourceInstanceName: { eq: "scamboxContent" } }
) {
nodes {
childMdx {
id
body
frontmatter {
platform
tags
title
url
}
}
}
}
}
`);
@ -40,6 +58,26 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
},
});
});
result.data.scambox.nodes.forEach((node) => {
if (!node.childMdx) return;
// eslint-disable-next-line no-undef
console.log(
"Creating Page: ",
`/*/scambox/${node.childMdx.frontmatter.url}`
);
//["en", "de"].forEach((lang) => {
createPage({
path: `/scambox/${node.childMdx.frontmatter.url}`,
component: scamboxTemplate,
context: {
mdxId: node.childMdx.id,
},
});
//})
});
};
const config = require("./config.js");