Skip to content

Commit 9e6a77d

Browse files
KyleAMathewserquhart
authored andcommitted
Fix for #4225 & various other tweaks
1 parent 5131876 commit 9e6a77d

15 files changed

+613
-428
lines changed

gatsby-node.js

+12-64
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,37 @@
1-
const path = require("path");
1+
const path = require("path")
22

33
exports.createPages = ({ boundActionCreators, graphql }) => {
4-
const { createPage } = boundActionCreators;
4+
const { createPage } = boundActionCreators
55

66
return graphql(`
77
{
8-
allMarkdownRemark(
9-
sort: { order: DESC, fields: [frontmatter___date] }
10-
limit: 1000
11-
) {
8+
allMarkdownRemark(limit: 1000) {
129
edges {
1310
node {
14-
excerpt(pruneLength: 400)
15-
html
16-
id
1711
frontmatter {
18-
templateKey
1912
path
20-
date
21-
title
22-
image
23-
heading
24-
description
25-
intro {
26-
blurbs {
27-
image
28-
text
29-
}
30-
heading
31-
description
32-
}
33-
main {
34-
heading
35-
description
36-
image1 {
37-
alt
38-
image
39-
}
40-
image2 {
41-
alt
42-
image
43-
}
44-
image3 {
45-
alt
46-
image
47-
}
48-
}
49-
testimonials {
50-
author
51-
quote
52-
}
53-
full_image
54-
pricing {
55-
heading
56-
description
57-
plans {
58-
description
59-
items
60-
plan
61-
price
62-
}
63-
}
13+
templateKey
6414
}
6515
}
6616
}
6717
}
6818
}
6919
`).then(result => {
7020
if (result.errors) {
71-
result.errors.forEach(e => console.error(e.toString()));
72-
return Promise.reject(result.errors);
21+
result.errors.forEach(e => console.error(e.toString()))
22+
return Promise.reject(result.errors)
7323
}
7424

7525
return result.data.allMarkdownRemark.edges.forEach(({ node }) => {
76-
const pagePath = node.frontmatter.path;
26+
const pagePath = node.frontmatter.path
7727
createPage({
7828
path: pagePath,
7929
component: path.resolve(
8030
`src/templates/${String(node.frontmatter.templateKey)}.js`
8131
),
8232
// additional data can be passed via context
83-
context: {
84-
path: pagePath
85-
}
86-
});
87-
});
88-
});
89-
};
33+
context: {},
34+
})
35+
})
36+
})
37+
}

0 commit comments

Comments
 (0)