first work on the resume and portfolio

This commit is contained in:
2022-10-08 11:28:35 +02:00
parent 9c0112d52f
commit 191b5b8a09
14 changed files with 35 additions and 286 deletions

View File

@@ -39,21 +39,29 @@ const createPages: GatsbyNode["createPages"] = async ({ graphql, actions }) => {
const pages = await queries.pagesQuery(graphql);
const { pageTemplate, postTemplate } = constants.templates;
pages.forEach((edge) => {
const { node } = edge;
if (node?.frontmatter?.template === "page" && node?.fields?.slug) {
createPage({
path: node.fields.slug,
component: constants.templates.pageTemplate,
context: { slug: node.fields.slug },
});
} else if (node?.frontmatter?.template === "post" && node?.fields?.slug) {
createPage({
path: node.fields.slug,
component: constants.templates.postTemplate,
context: { slug: node.fields.slug, readingTime: node?.fields?.readingTime },
});
if (node?.fields?.slug) {
switch (node?.frontmatter?.template) {
case "page":
case "portfolioItem":
createPage({
path: node.fields.slug,
component: pageTemplate,
context: { slug: node.fields.slug },
});
break;
case "post":
createPage({
path: node.fields.slug,
component: postTemplate,
context: { slug: node.fields.slug, readingTime: node?.fields?.readingTime },
});
break;
}
}
});