Skip to content

Commit fd86fe3

Browse files
committedOct 18, 2017
first commit
0 parents  commit fd86fe3

16 files changed

+20200
-0
lines changed
 

‎.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Project dependencies
2+
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
3+
node_modules
4+
.cache/
5+
# Build directory
6+
public/
7+
.DS_Store
8+
yarn-error.log

‎LICENSE

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 gatsbyjs
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

‎README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# gatsby-starter-default
2+
The default Gatsby starter
3+
4+
For an overview of the project structure please refer to the [Gatsby documentation - Building with Components](https://www.gatsbyjs.org/docs/building-with-components/)
5+
6+
Install this starter (assuming Gatsby is installed) by running from your CLI:
7+
```
8+
gatsby new gatsby-example-site
9+
```
10+
11+
## Deploy
12+
13+
[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/gatsbyjs/gatsby-starter-default)

‎gatsby-config.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = {
2+
siteMetadata: {
3+
title: `Gatsby Default Starter`
4+
},
5+
plugins: [
6+
'gatsby-plugin-react-helmet',
7+
`gatsby-plugin-styled-components`,
8+
`gatsby-plugin-sass`,
9+
{
10+
resolve: `gatsby-source-filesystem`,
11+
options: {
12+
path: `${__dirname}/src/pages`,
13+
name: 'pages'
14+
}
15+
},
16+
{
17+
resolve: 'gatsby-transformer-remark',
18+
options: {
19+
plugins: []
20+
}
21+
}
22+
]
23+
};

‎gatsby-node.js

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
const path = require('path');
2+
3+
exports.createPages = ({ boundActionCreators, graphql }) => {
4+
const { createPage } = boundActionCreators;
5+
6+
const blogPostTemplate = path.resolve(`src/templates/blog-post.js`);
7+
8+
return graphql(`
9+
{
10+
allMarkdownRemark(sort: { order: DESC, fields: [frontmatter___date] }, limit: 1000) {
11+
edges {
12+
node {
13+
excerpt(pruneLength: 400)
14+
html
15+
id
16+
frontmatter {
17+
path
18+
date
19+
title
20+
}
21+
}
22+
}
23+
}
24+
}
25+
`).then(result => {
26+
if (result.errors) {
27+
return Promise.reject(result.errors);
28+
}
29+
result.data.allMarkdownRemark.edges.forEach(({ node }) => {
30+
createPage({
31+
path: node.frontmatter.path,
32+
component: blogPostTemplate,
33+
context: {} // additional data can be passed via context
34+
});
35+
});
36+
});
37+
};

‎package-lock.json

+11,335
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "gatsby-starter-default",
3+
"description": "Gatsby default starter",
4+
"version": "1.0.0",
5+
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
6+
"dependencies": {
7+
"bulma": "^0.6.0",
8+
"gatsby": "^1.9.63",
9+
"gatsby-link": "^1.6.21",
10+
"gatsby-plugin-react-helmet": "^1.0.5",
11+
"gatsby-plugin-sass": "^1.0.12",
12+
"gatsby-plugin-styled-components": "^1.0.5",
13+
"gatsby-source-filesystem": "^1.5.5",
14+
"gatsby-transformer-remark": "^1.7.17"
15+
},
16+
"keywords": [
17+
"gatsby"
18+
],
19+
"license": "MIT",
20+
"main": "n/a",
21+
"scripts": {
22+
"build": "gatsby build",
23+
"develop": "gatsby develop",
24+
"format": "prettier --trailing-comma es5 --no-semi --single-quote --write 'src/**/*.js'",
25+
"test": "echo \"Error: no test specified\" && exit 1"
26+
},
27+
"devDependencies": {
28+
"prettier": "^1.7.4"
29+
}
30+
}

‎src/img/github-icon.svg

+5
Loading

‎src/layouts/index.js

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
import Link from 'gatsby-link';
4+
import Helmet from 'react-helmet';
5+
import github from '../img/github-icon.svg';
6+
import 'bulma';
7+
8+
const Navbar = () => (
9+
<nav className="navbar is-light">
10+
<div className="navbar-brand">
11+
<Link to="/" className="navbar-item">
12+
Gatsby powered by Netlify CMS
13+
</Link>
14+
<a className="navbar-item" href="https://github.com/AustinGreen/gatsby-netlify-cms-boilerplate" target="_blank">
15+
<span className="icon">
16+
<img src={github} alt="Github" />
17+
</span>
18+
</a>
19+
</div>
20+
</nav>
21+
);
22+
23+
const TemplateWrapper = ({ children }) => (
24+
<div>
25+
<Helmet title="Home | Gatsby + Netlify CMS" />
26+
<Navbar />
27+
<div>{children()}</div>
28+
</div>
29+
);
30+
31+
TemplateWrapper.propTypes = {
32+
children: PropTypes.func
33+
};
34+
35+
export default TemplateWrapper;

‎src/pages/404.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from 'react'
2+
3+
const NotFoundPage = () => (
4+
<div>
5+
<h1>NOT FOUND</h1>
6+
<p>You just hit a route that doesn&#39;t exist... the sadness.</p>
7+
</div>
8+
)
9+
10+
export default NotFoundPage
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
layout: blog
3+
path: /intro-to-graphql
4+
date: '2017-08-08T17:12:33.962Z'
5+
title: Introduction to GraphQL
6+
---
7+
Modern apps are interdependent and dynamic. For example, you probably sign in to various web apps using your GitHub account. These apps may be grabbing your avatar directly from GitHub, or some information about your projects. The data about your project is always changing so, as an added bonus, these connections are constantly updating the information that is displayed.
8+
9+
GitHub isn’t the only web app that does this. A few examples of **rich data** sources are:
10+
11+
- Weather Underground: get access to your local weather or report it from you home weather station
12+
- Flight stats: grab information about any flight, and
13+
- ESPN: keep track of your favorite sports team’s record
14+
- This data is available to you because the developers of these apps created a public Application Program Interface (API).
15+
16+
This course is going to introduce the concept of using APIs via GitHub’s GraphQL. You’ll learn how to gather data from GitHub, and how to make a simple change.
17+
18+
### More Examples
19+
20+
- Here's another

‎src/pages/index.js

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import React from 'react';
2+
import Link from 'gatsby-link';
3+
import Helmet from 'react-helmet';
4+
5+
export default function Index({ data }) {
6+
const { edges: posts } = data.allMarkdownRemark;
7+
return (
8+
<section className="section">
9+
<div className="container">
10+
{posts.filter(post => post.node.frontmatter.title.length > 0).map(({ node: post }) => {
11+
return (
12+
<div className="content" style={{ border: '1px solid #eaecee', padding: '2em 4em' }} key={post.id}>
13+
<p>
14+
<Link to={post.frontmatter.path}>{post.frontmatter.title}</Link>
15+
<span> &bull; </span>
16+
<small>{post.frontmatter.date}</small>
17+
</p>
18+
<p>
19+
{post.excerpt}
20+
<br />
21+
<br />
22+
<Link className="button is-info is-small" to={post.frontmatter.path}>
23+
Keep Reading
24+
</Link>
25+
</p>
26+
</div>
27+
);
28+
})}
29+
</div>
30+
</section>
31+
);
32+
}
33+
34+
export const pageQuery = graphql`
35+
query IndexQuery {
36+
allMarkdownRemark(sort: { order: DESC, fields: [frontmatter___date] }) {
37+
edges {
38+
node {
39+
excerpt(pruneLength: 400)
40+
id
41+
frontmatter {
42+
title
43+
date(formatString: "MMMM DD, YYYY")
44+
path
45+
}
46+
}
47+
}
48+
}
49+
}
50+
`;

‎src/templates/blog-post.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import React from 'react';
2+
import Helmet from 'react-helmet';
3+
4+
export default function Template({ data }) {
5+
const { markdownRemark: post } = data;
6+
return (
7+
<section className="section">
8+
<Helmet title={`Blog | ${post.frontmatter.title}`} />
9+
<div className="container content">
10+
<h1 className="title is-size-2 has-text-info is-bold-light">{post.frontmatter.title}</h1>
11+
<div dangerouslySetInnerHTML={{ __html: post.html }} />
12+
</div>
13+
</section>
14+
);
15+
}
16+
17+
export const pageQuery = graphql`
18+
query BlogPostByPath($path: String!) {
19+
markdownRemark(frontmatter: { path: { eq: $path } }) {
20+
html
21+
frontmatter {
22+
path
23+
date(formatString: "MMMM DD, YYYY")
24+
title
25+
}
26+
}
27+
}
28+
`;

‎static/admin/config.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
backend:
2+
name: github
3+
repo: AustinGreen/gatsby-netlify-cms-boilerplate # Path to your Github repository
4+
branch: master # Branch to update
5+
6+
media_folder: "/static"
7+
8+
collections:
9+
- name: "blog" # Used in routes, e.g., /admin/collections/blog
10+
label: "Blog" # Used in the UI
11+
folder: "src/pages/blog" # The path to the folder where the documents are stored
12+
create: true # Allow users to create new documents in this collection
13+
slug: "{{year}}-{{month}}-{{day}}-{{slug}}" # Filename template, e.g., YYYY-MM-DD-title.md
14+
fields: # The fields for each document, usually in front matter
15+
- {label: "Layout", name: "layout", widget: "hidden", default: "blog"}
16+
- {label: "Path", name: "path", widget: "string"}
17+
- {label: "Title", name: "title", widget: "string"}
18+
- {label: "Body", name: "body", widget: "markdown"}

‎static/admin/index.html

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Content Manager</title>
7+
8+
<link rel="stylesheet" href="https://unpkg.com/netlify-cms@~0.4/dist/cms.css" />
9+
10+
</head>
11+
<body>
12+
<script src="https://unpkg.com/netlify-cms@~0.4/dist/cms.js"></script>
13+
</body>
14+
</html>

‎yarn.lock

+8,552
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.