Skip to content

Commit

Permalink
Gatsby v2
Browse files Browse the repository at this point in the history
  • Loading branch information
adamyonk committed Dec 3, 2018
1 parent 2652779 commit 00608c9
Show file tree
Hide file tree
Showing 34 changed files with 16,207 additions and 12,180 deletions.
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.cache
package.json
package-lock.json
public
static
10 changes: 0 additions & 10 deletions .prettierrc

This file was deleted.

10 changes: 10 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
trailingComma: "all",
semi: false,
overrides: [
{
files: ".{prettier,babel}rc",
options: { parser: "json" },
},
],
}
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ It follows the [JAMstack architecture](https://jamstack.org) by using Git as a s
- [Gatsby CLI](https://www.gatsbyjs.org/docs/)

### Run Locally

```
gatsby new [SITE_DIRECTORY_NAME] https://github.com/AustinGreen/gatsby-starter-netlify-cms/
$ cd [SITE_DIRECTORY_NAME]
Expand All @@ -20,17 +21,19 @@ $ gatsby serve
```

## Accessing the CMS
Follow the [Netlify CMS Quick Start Guide](https://www.netlifycms.org/docs/quick-start/#authentication) to set up authentication, and hosting.

Follow the [Netlify CMS Quick Start Guide](https://www.netlifycms.org/docs/quick-start/#authentication) to set up authentication, and hosting.

- - -
---

### Debugging
Windows users might encounter ```node-gyp``` errors when trying to npm install.

Windows users might encounter `node-gyp` errors when trying to npm install.
To resolve, make sure that you have both Python 2.7 and the Visual C++ build environment installed.

```
npm config set python python2.7
npm config set python python2.7
npm install --global --production windows-build-tools
```

[Full details here](https://www.npmjs.com/package/node-gyp 'NPM node-gyp page')
[Full details here](https://www.npmjs.com/package/node-gyp "NPM node-gyp page")
106 changes: 80 additions & 26 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,88 @@ module.exports = {
author: "Adam Jahnke",
},
plugins: [
{ resolve: "gatsby-plugin-react-next" },
{ resolve: "gatsby-plugin-react-helmet" },
{ resolve: "gatsby-plugin-styled-jsx" },
{
resolve: "gatsby-plugin-feed-generator",
options: {
feedQuery: `
{
allMarkdownRemark(
filter: { frontmatter: { templateKey: { eq: "post" }, published: { eq: true } } },
sort: { order: DESC, fields: [frontmatter___date] }
) {
edges {
node {
html
id
frontmatter {
date
path
title
}
}
}
}
}
`,
},
},
// {
// resolve: `gatsby-plugin-feed`,
// options: {
// query: `
// {
// site {
// siteMetadata {
// title
// description
// siteUrl
// site_url: siteUrl
// }
// }
// }
// `,
// feeds: [
// {
// serialize: ({ query: { site, allMarkdownRemark } }) => {
// return allMarkdownRemark.edges.map(edge => {
// return Object.assign({}, edge.node.frontmatter, {
// description: edge.node.excerpt,
// date: edge.node.frontmatter.date,
// url: site.siteMetadata.siteUrl + edge.node.fields.slug,
// guid: site.siteMetadata.siteUrl + edge.node.fields.slug,
// custom_elements: [{ "content:encoded": edge.node.html }],
// })
// })
// },
// query: `
// {
// allMarkdownRemark(
// limit: 1000,
// sort: { order: DESC, fields: [frontmatter___date] },
// filter: {frontmatter: { draft: { ne: true } }}
// ) {
// edges {
// node {
// excerpt
// html
// fields { slug }
// frontmatter {
// title
// date
// }
// }
// }
// }
// }
// `,
// output: "/rss.xml",
// title: "Gatsby RSS Feed",
// },
// ],
// },
// },
// {
// resolve: "gatsby-plugin-feed-generator",
// options: {
// feedQuery: `
// {
// allMarkdownRemark(
// filter: { frontmatter: { templateKey: { eq: "post" }, published: { eq: true } } },
// sort: { order: DESC, fields: [frontmatter___date] }
// ) {
// edges {
// node {
// html
// id
// frontmatter {
// date
// path
// title
// }
// }
// }
// }
// }
// `,
// },
// },
{
resolve: "gatsby-source-filesystem",
options: {
Expand Down
7 changes: 4 additions & 3 deletions gatsby-node.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
require("@babel/polyfill")
const path = require("path")

exports.createPages = ({ boundActionCreators, graphql }) => {
const { createPage } = boundActionCreators
exports.createPages = ({ actions, graphql }) => {
const { createPage } = actions

return graphql(`
{
Expand Down Expand Up @@ -58,7 +59,7 @@ exports.createPages = ({ boundActionCreators, graphql }) => {
createPage({
path: node.frontmatter.path,
component: path.resolve(
`src/templates/${String(node.frontmatter.templateKey)}.js`
`src/templates/${String(node.frontmatter.templateKey)}.js`,
),
context: {}, // additional data can be passed via context
})
Expand Down
Loading

0 comments on commit 00608c9

Please sign in to comment.