Skip to content

Commit

Permalink
Merge pull request #1105 from cindyledev/issue-1104
Browse files Browse the repository at this point in the history
Fixes #1104 fix error in building the frontend
  • Loading branch information
manekenpix authored Aug 2, 2020
2 parents 504035b + 1fa647a commit 279a2d8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
12 changes: 7 additions & 5 deletions src/frontend/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ exports.onPreInit = async function ({ reporter }) {
exports.createPages = async ({ actions, graphql, reporter }) => {
const { createPage } = actions;

const pageTemplate = path.resolve(`src/templates/template.js`);
const pageTemplate = require.resolve(`./src/templates/template.js`);

const result = await graphql(`
{
allMarkdownRemark(sort: { order: DESC }, limit: 1000) {
allMarkdownRemark(sort: { order: DESC, fields: [frontmatter___slug] }, limit: 1000) {
edges {
node {
frontmatter {
path
slug
}
}
}
Expand All @@ -113,9 +113,11 @@ exports.createPages = async ({ actions, graphql, reporter }) => {

result.data.allMarkdownRemark.edges.forEach(({ node }) => {
createPage({
path: node.frontmatter.path,
path: node.frontmatter.slug,
component: pageTemplate,
context: {}, // additional data can be passed via context
context: {
slug: node.frontmatter.slug,
}, // additional data can be passed via context
});
});
};
2 changes: 1 addition & 1 deletion src/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"apollo-link-http": "1.5.17",
"dotenv": "8.2.0",
"eslint-plugin-react-hooks": "3.0.0",
"gatsby": "2.20.23",
"gatsby": "2.24.23",
"gatsby-image": "2.3.4",
"gatsby-plugin-manifest": "2.3.3",
"gatsby-plugin-material-ui": "2.1.6",
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/markdown-pages/about.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
path: '/about'
slug: '/about'
title: 'About'
---

Expand Down
6 changes: 3 additions & 3 deletions src/frontend/src/templates/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@ Template.propTypes = {
};

export const pageQuery = graphql`
query($path: String!) {
markdownRemark(frontmatter: { path: { eq: $path } }) {
query($slug: String!) {
markdownRemark(frontmatter: { slug: { eq: $slug } }) {
html
frontmatter {
path
slug
title
}
}
Expand Down

0 comments on commit 279a2d8

Please sign in to comment.