- implement i18n

- translation dynamic for sections
- added articles for SEO
This commit is contained in:
Amruth Pillai
2020-07-16 08:42:19 +05:30
parent b7c565de79
commit a7657b4a5c
74 changed files with 2373 additions and 586 deletions

View File

@ -25,3 +25,41 @@ exports.onCreatePage = async ({ page, actions }) => {
createPage(page);
}
};
exports.createPages = async ({ actions, graphql, reporter }) => {
const { createPage } = actions;
const blogTemplate = require.resolve(`./src/components/Blog.js`);
const result = await graphql(`
{
allMarkdownRemark(
sort: { order: DESC, fields: [frontmatter___date] }
limit: 1000
) {
edges {
node {
frontmatter {
slug
}
}
}
}
}
`);
if (result.errors) {
reporter.panicOnBuild(`Error while running GraphQL query.`);
return;
}
result.data.allMarkdownRemark.edges.forEach(({ node }) => {
createPage({
path: node.frontmatter.slug,
component: blogTemplate,
context: {
slug: node.frontmatter.slug,
},
});
});
};