mirror of
https://github.com/LukeHagar/unicorn-utterances.git
synced 2025-12-06 04:21:55 +00:00
Initial commit from gatsby: (https://github.com/gatsbyjs/gatsby-starter-blog.git)
This commit is contained in:
69
.gitignore
vendored
Normal file
69
.gitignore
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# Typescript v1 declaration files
|
||||
typings/
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
|
||||
# gatsby files
|
||||
.cache/
|
||||
public
|
||||
|
||||
# Mac files
|
||||
.DS_Store
|
||||
|
||||
# Yarn
|
||||
yarn-error.log
|
||||
.pnp/
|
||||
.pnp.js
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
7
.prettierrc
Normal file
7
.prettierrc
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"endOfLine": "lf",
|
||||
"semi": false,
|
||||
"singleQuote": false,
|
||||
"tabWidth": 2,
|
||||
"trailingComma": "es5"
|
||||
}
|
||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Gatsbyjs
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
97
README.md
Normal file
97
README.md
Normal file
@@ -0,0 +1,97 @@
|
||||
<!-- AUTO-GENERATED-CONTENT:START (STARTER) -->
|
||||
<p align="center">
|
||||
<a href="https://www.gatsbyjs.org">
|
||||
<img alt="Gatsby" src="https://www.gatsbyjs.org/monogram.svg" width="60" />
|
||||
</a>
|
||||
</p>
|
||||
<h1 align="center">
|
||||
Gatsby's blog starter
|
||||
</h1>
|
||||
|
||||
Kick off your project with this blog boilerplate. This starter ships with the main Gatsby configuration files you might need to get up and running blazing fast with the blazing fast app generator for React.
|
||||
|
||||
_Have another more specific idea? You may want to check out our vibrant collection of [official and community-created starters](https://www.gatsbyjs.org/docs/gatsby-starters/)._
|
||||
|
||||
## 🚀 Quick start
|
||||
|
||||
1. **Create a Gatsby site.**
|
||||
|
||||
Use the Gatsby CLI to create a new site, specifying the blog starter.
|
||||
|
||||
```sh
|
||||
# create a new Gatsby site using the blog starter
|
||||
gatsby new my-blog-starter https://github.com/gatsbyjs/gatsby-starter-blog
|
||||
```
|
||||
|
||||
1. **Start developing.**
|
||||
|
||||
Navigate into your new site’s directory and start it up.
|
||||
|
||||
```sh
|
||||
cd my-blog-starter/
|
||||
gatsby develop
|
||||
```
|
||||
|
||||
1. **Open the source code and start editing!**
|
||||
|
||||
Your site is now running at `http://localhost:8000`!
|
||||
|
||||
_Note: You'll also see a second link: _`http://localhost:8000/___graphql`_. This is a tool you can use to experiment with querying your data. Learn more about using this tool in the [Gatsby tutorial](https://www.gatsbyjs.org/tutorial/part-five/#introducing-graphiql)._
|
||||
|
||||
Open the `my-blog-starter` directory in your code editor of choice and edit `src/pages/index.js`. Save your changes and the browser will update in real time!
|
||||
|
||||
## 🧐 What's inside?
|
||||
|
||||
A quick look at the top-level files and directories you'll see in a Gatsby project.
|
||||
|
||||
.
|
||||
├── node_modules
|
||||
├── src
|
||||
├── .gitignore
|
||||
├── .prettierrc
|
||||
├── gatsby-browser.js
|
||||
├── gatsby-config.js
|
||||
├── gatsby-node.js
|
||||
├── gatsby-ssr.js
|
||||
├── LICENSE
|
||||
├── package-lock.json
|
||||
├── package.json
|
||||
└── README.md
|
||||
|
||||
1. **`/node_modules`**: This directory contains all of the modules of code that your project depends on (npm packages) are automatically installed.
|
||||
|
||||
2. **`/src`**: This directory will contain all of the code related to what you will see on the front-end of your site (what you see in the browser) such as your site header or a page template. `src` is a convention for “source code”.
|
||||
|
||||
3. **`.gitignore`**: This file tells git which files it should not track / not maintain a version history for.
|
||||
|
||||
4. **`.prettierrc`**: This is a configuration file for [Prettier](https://prettier.io/). Prettier is a tool to help keep the formatting of your code consistent.
|
||||
|
||||
5. **`gatsby-browser.js`**: This file is where Gatsby expects to find any usage of the [Gatsby browser APIs](https://www.gatsbyjs.org/docs/browser-apis/) (if any). These allow customization/extension of default Gatsby settings affecting the browser.
|
||||
|
||||
6. **`gatsby-config.js`**: This is the main configuration file for a Gatsby site. This is where you can specify information about your site (metadata) like the site title and description, which Gatsby plugins you’d like to include, etc. (Check out the [config docs](https://www.gatsbyjs.org/docs/gatsby-config/) for more detail).
|
||||
|
||||
7. **`gatsby-node.js`**: This file is where Gatsby expects to find any usage of the [Gatsby Node APIs](https://www.gatsbyjs.org/docs/node-apis/) (if any). These allow customization/extension of default Gatsby settings affecting pieces of the site build process.
|
||||
|
||||
8. **`gatsby-ssr.js`**: This file is where Gatsby expects to find any usage of the [Gatsby server-side rendering APIs](https://www.gatsbyjs.org/docs/ssr-apis/) (if any). These allow customization of default Gatsby settings affecting server-side rendering.
|
||||
|
||||
9. **`LICENSE`**: Gatsby is licensed under the MIT license.
|
||||
|
||||
10. **`package-lock.json`** (See `package.json` below, first). This is an automatically generated file based on the exact versions of your npm dependencies that were installed for your project. **(You won’t change this file directly).**
|
||||
|
||||
11. **`package.json`**: A manifest file for Node.js projects, which includes things like metadata (the project’s name, author, etc). This manifest is how npm knows which packages to install for your project.
|
||||
|
||||
12. **`README.md`**: A text file containing useful reference information about your project.
|
||||
|
||||
## 🎓 Learning Gatsby
|
||||
|
||||
Looking for more guidance? Full documentation for Gatsby lives [on the website](https://www.gatsbyjs.org/). Here are some places to start:
|
||||
|
||||
- **For most developers, we recommend starting with our [in-depth tutorial for creating a site with Gatsby](https://www.gatsbyjs.org/tutorial/).** It starts with zero assumptions about your level of ability and walks through every step of the process.
|
||||
|
||||
- **To dive straight into code samples, head [to our documentation](https://www.gatsbyjs.org/docs/).** In particular, check out the _Guides_, _API Reference_, and _Advanced Tutorials_ sections in the sidebar.
|
||||
|
||||
## 💫 Deploy
|
||||
|
||||
[](https://app.netlify.com/start/deploy?repository=https://github.com/gatsbyjs/gatsby-starter-blog)
|
||||
|
||||
<!-- AUTO-GENERATED-CONTENT:END -->
|
||||
BIN
content/assets/gatsby-icon.png
Normal file
BIN
content/assets/gatsby-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
BIN
content/assets/profile-pic.jpg
Normal file
BIN
content/assets/profile-pic.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
21
content/blog/hello-world/index.md
Normal file
21
content/blog/hello-world/index.md
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
title: Hello World
|
||||
date: "2015-05-01T22:12:03.284Z"
|
||||
---
|
||||
|
||||
This is my first post on my new fake blog! How exciting!
|
||||
|
||||
I'm sure I'll write a lot more interesting things in the future.
|
||||
|
||||
Oh, and here's a great quote from this Wikipedia on
|
||||
[salted duck eggs](http://en.wikipedia.org/wiki/Salted_duck_egg).
|
||||
|
||||
> A salted duck egg is a Chinese preserved food product made by soaking duck
|
||||
> eggs in brine, or packing each egg in damp, salted charcoal. In Asian
|
||||
> supermarkets, these eggs are sometimes sold covered in a thick layer of salted
|
||||
> charcoal paste. The eggs may also be sold with the salted paste removed,
|
||||
> wrapped in plastic, and vacuum packed. From the salt curing process, the
|
||||
> salted duck eggs have a briny aroma, a gelatin-like egg white and a
|
||||
> firm-textured, round yolk that is bright orange-red in color.
|
||||
|
||||

|
||||
BIN
content/blog/hello-world/salty_egg.jpg
Normal file
BIN
content/blog/hello-world/salty_egg.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 668 KiB |
108
content/blog/hi-folks/index.md
Normal file
108
content/blog/hi-folks/index.md
Normal file
@@ -0,0 +1,108 @@
|
||||
---
|
||||
title: New Beginnings
|
||||
date: "2015-05-28T22:40:32.169Z"
|
||||
description: This is a custom description for SEO and Open Graph purposes, rather than the default generated excerpt. Simply add a description field to the frontmatter.
|
||||
---
|
||||
|
||||
Far far away, behind the word mountains, far from the countries Vokalia and
|
||||
Consonantia, there live the blind texts. Separated they live in Bookmarksgrove
|
||||
right at the coast of the Semantics, a large language ocean. A small river named
|
||||
Duden flows by their place and supplies it with the necessary regelialia.
|
||||
|
||||
## On deer horse aboard tritely yikes and much
|
||||
|
||||
The Big Oxmox advised her not to do so, because there were thousands of bad
|
||||
Commas, wild Question Marks and devious Semikoli, but the Little Blind Text
|
||||
didn’t listen. She packed her seven versalia, put her initial into the belt and
|
||||
made herself on the way.
|
||||
|
||||
- This however showed weasel
|
||||
- Well uncritical so misled
|
||||
- this is very interesting
|
||||
- Goodness much until that fluid owl
|
||||
|
||||
When she reached the first hills of the **Italic Mountains**, she had a last
|
||||
view back on the skyline of her hometown _Bookmarksgrove_, the headline of
|
||||
[Alphabet Village](http://google.com) and the subline of her own road, the Line
|
||||
Lane. Pityful a rethoric question ran over her cheek, then she continued her
|
||||
way. On her way she met a copy.
|
||||
|
||||
### Overlaid the jeepers uselessly much excluding
|
||||
|
||||
But nothing the copy said could convince her and so it didn’t take long until a
|
||||
few insidious Copy Writers ambushed her, made her drunk with
|
||||
[Longe and Parole](http://google.com) and dragged her into their agency, where
|
||||
they abused her for their projects again and again. And if she hasn’t been
|
||||
rewritten, then they are still using her.
|
||||
|
||||
> Far far away, behind the word mountains, far from the countries Vokalia and
|
||||
> Consonantia, there live the blind texts. Separated they live in Bookmarksgrove
|
||||
> right at the coast of the Semantics, a large language ocean.
|
||||
|
||||
It is a paradisematic country, in which roasted parts of sentences fly into your
|
||||
mouth. Even the all-powerful Pointing has no control about the blind texts it is
|
||||
an almost unorthographic life One day however a small line of blind text by the
|
||||
name of Lorem Ipsum decided to leave for the far World of Grammar.
|
||||
|
||||
### According a funnily until pre-set or arrogant well cheerful
|
||||
|
||||
The Big Oxmox advised her not to do so, because there were thousands of bad
|
||||
Commas, wild Question Marks and devious Semikoli, but the Little Blind Text
|
||||
didn’t listen. She packed her seven versalia, put her initial into the belt and
|
||||
made herself on the way.
|
||||
|
||||
1. So baboon this
|
||||
2. Mounted militant weasel gregariously admonishingly straightly hey
|
||||
3. Dear foresaw hungry and much some overhung
|
||||
4. Rash opossum less because less some amid besides yikes jeepers frenetic
|
||||
impassive fruitlessly shut
|
||||
|
||||
When she reached the first hills of the Italic Mountains, she had a last view
|
||||
back on the skyline of her hometown Bookmarksgrove, the headline of Alphabet
|
||||
Village and the subline of her own road, the Line Lane. Pityful a rethoric
|
||||
question ran over her cheek, then she continued her way. On her way she met a
|
||||
copy.
|
||||
|
||||
> The copy warned the Little Blind Text, that where it came from it would have
|
||||
> been rewritten a thousand times and everything that was left from its origin
|
||||
> would be the word "and" and the Little Blind Text should turn around and
|
||||
> return to its own, safe country.
|
||||
|
||||
But nothing the copy said could convince her and so it didn’t take long until a
|
||||
few insidious Copy Writers ambushed her, made her drunk with Longe and Parole
|
||||
and dragged her into their agency, where they abused her for their projects
|
||||
again and again. And if she hasn’t been rewritten, then they are still using
|
||||
her. Far far away, behind the word mountains, far from the countries Vokalia and
|
||||
Consonantia, there live the blind texts.
|
||||
|
||||
#### Silent delightfully including because before one up barring chameleon
|
||||
|
||||
Separated they live in Bookmarksgrove right at the coast of the Semantics, a
|
||||
large language ocean. A small river named Duden flows by their place and
|
||||
supplies it with the necessary regelialia. It is a paradisematic country, in
|
||||
which roasted parts of sentences fly into your mouth.
|
||||
|
||||
Even the all-powerful Pointing has no control about the blind texts it is an
|
||||
almost unorthographic life One day however a small line of blind text by the
|
||||
name of Lorem Ipsum decided to leave for the far World of Grammar. The Big Oxmox
|
||||
advised her not to do so, because there were thousands of bad Commas, wild
|
||||
Question Marks and devious Semikoli, but the Little Blind Text didn’t listen.
|
||||
|
||||
##### Wherever far wow thus a squirrel raccoon jeez jaguar this from along
|
||||
|
||||
She packed her seven versalia, put her initial into the belt and made herself on
|
||||
the way. When she reached the first hills of the Italic Mountains, she had a
|
||||
last view back on the skyline of her hometown Bookmarksgrove, the headline of
|
||||
Alphabet Village and the subline of her own road, the Line Lane. Pityful a
|
||||
rethoric question ran over her cheek, then she continued her way. On her way she
|
||||
met a copy.
|
||||
|
||||
###### Slapped cozy a that lightheartedly and far
|
||||
|
||||
The copy warned the Little Blind Text, that where it came from it would have
|
||||
been rewritten a thousand times and everything that was left from its origin
|
||||
would be the word "and" and the Little Blind Text should turn around and return
|
||||
to its own, safe country. But nothing the copy said could convince her and so it
|
||||
didn’t take long until a few insidious Copy Writers ambushed her, made her drunk
|
||||
with Longe and Parole and dragged her into their agency, where they abused her
|
||||
for their projects again and again.
|
||||
13
content/blog/my-second-post/index.md
Normal file
13
content/blog/my-second-post/index.md
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
title: My Second Post!
|
||||
date: "2015-05-06T23:46:37.121Z"
|
||||
---
|
||||
|
||||
Wow! I love blogging so much already.
|
||||
|
||||
Did you know that "despite its name, salted duck eggs can also be made from
|
||||
chicken eggs, though the taste and texture will be somewhat different, and the
|
||||
egg yolk will be less rich."?
|
||||
([Wikipedia Link](http://en.wikipedia.org/wiki/Salted_duck_egg))
|
||||
|
||||
Yeah, I didn't either.
|
||||
3
gatsby-browser.js
Normal file
3
gatsby-browser.js
Normal file
@@ -0,0 +1,3 @@
|
||||
// custom typefaces
|
||||
import "typeface-montserrat"
|
||||
import "typeface-merriweather"
|
||||
78
gatsby-config.js
Normal file
78
gatsby-config.js
Normal file
@@ -0,0 +1,78 @@
|
||||
module.exports = {
|
||||
siteMetadata: {
|
||||
title: `Gatsby Starter Blog`,
|
||||
author: `Kyle Mathews`,
|
||||
description: `A starter blog demonstrating what Gatsby can do.`,
|
||||
siteUrl: `https://gatsby-starter-blog-demo.netlify.com/`,
|
||||
social: {
|
||||
twitter: `kylemathews`,
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
{
|
||||
resolve: `gatsby-source-filesystem`,
|
||||
options: {
|
||||
path: `${__dirname}/content/blog`,
|
||||
name: `blog`,
|
||||
},
|
||||
},
|
||||
{
|
||||
resolve: `gatsby-source-filesystem`,
|
||||
options: {
|
||||
path: `${__dirname}/content/assets`,
|
||||
name: `assets`,
|
||||
},
|
||||
},
|
||||
{
|
||||
resolve: `gatsby-transformer-remark`,
|
||||
options: {
|
||||
plugins: [
|
||||
{
|
||||
resolve: `gatsby-remark-images`,
|
||||
options: {
|
||||
maxWidth: 590,
|
||||
},
|
||||
},
|
||||
{
|
||||
resolve: `gatsby-remark-responsive-iframe`,
|
||||
options: {
|
||||
wrapperStyle: `margin-bottom: 1.0725rem`,
|
||||
},
|
||||
},
|
||||
`gatsby-remark-prismjs`,
|
||||
`gatsby-remark-copy-linked-files`,
|
||||
`gatsby-remark-smartypants`,
|
||||
],
|
||||
},
|
||||
},
|
||||
`gatsby-transformer-sharp`,
|
||||
`gatsby-plugin-sharp`,
|
||||
{
|
||||
resolve: `gatsby-plugin-google-analytics`,
|
||||
options: {
|
||||
//trackingId: `ADD YOUR TRACKING ID HERE`,
|
||||
},
|
||||
},
|
||||
`gatsby-plugin-feed`,
|
||||
{
|
||||
resolve: `gatsby-plugin-manifest`,
|
||||
options: {
|
||||
name: `Gatsby Starter Blog`,
|
||||
short_name: `GatsbyJS`,
|
||||
start_url: `/`,
|
||||
background_color: `#ffffff`,
|
||||
theme_color: `#663399`,
|
||||
display: `minimal-ui`,
|
||||
icon: `content/assets/gatsby-icon.png`,
|
||||
},
|
||||
},
|
||||
`gatsby-plugin-offline`,
|
||||
`gatsby-plugin-react-helmet`,
|
||||
{
|
||||
resolve: `gatsby-plugin-typography`,
|
||||
options: {
|
||||
pathToConfigModule: `src/utils/typography`,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
66
gatsby-node.js
Normal file
66
gatsby-node.js
Normal file
@@ -0,0 +1,66 @@
|
||||
const path = require(`path`)
|
||||
const { createFilePath } = require(`gatsby-source-filesystem`)
|
||||
|
||||
exports.createPages = ({ graphql, actions }) => {
|
||||
const { createPage } = actions
|
||||
|
||||
const blogPost = path.resolve(`./src/templates/blog-post.js`)
|
||||
return graphql(
|
||||
`
|
||||
{
|
||||
allMarkdownRemark(
|
||||
sort: { fields: [frontmatter___date], order: DESC }
|
||||
limit: 1000
|
||||
) {
|
||||
edges {
|
||||
node {
|
||||
fields {
|
||||
slug
|
||||
}
|
||||
frontmatter {
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
).then(result => {
|
||||
if (result.errors) {
|
||||
throw result.errors
|
||||
}
|
||||
|
||||
// Create blog posts pages.
|
||||
const posts = result.data.allMarkdownRemark.edges
|
||||
|
||||
posts.forEach((post, index) => {
|
||||
const previous = index === posts.length - 1 ? null : posts[index + 1].node
|
||||
const next = index === 0 ? null : posts[index - 1].node
|
||||
|
||||
createPage({
|
||||
path: post.node.fields.slug,
|
||||
component: blogPost,
|
||||
context: {
|
||||
slug: post.node.fields.slug,
|
||||
previous,
|
||||
next,
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
return null
|
||||
})
|
||||
}
|
||||
|
||||
exports.onCreateNode = ({ node, actions, getNode }) => {
|
||||
const { createNodeField } = actions
|
||||
|
||||
if (node.internal.type === `MarkdownRemark`) {
|
||||
const value = createFilePath({ node, getNode })
|
||||
createNodeField({
|
||||
name: `slug`,
|
||||
node,
|
||||
value,
|
||||
})
|
||||
}
|
||||
}
|
||||
16055
package-lock.json
generated
Normal file
16055
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
59
package.json
Normal file
59
package.json
Normal file
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"name": "gatsby-starter-blog",
|
||||
"private": true,
|
||||
"description": "A starter for a blog powered by Gatsby and Markdown",
|
||||
"version": "0.1.0",
|
||||
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
|
||||
"bugs": {
|
||||
"url": "https://github.com/gatsbyjs/gatsby/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"gatsby": "^2.8.2",
|
||||
"gatsby-image": "^2.1.2",
|
||||
"gatsby-plugin-feed": "^2.2.2",
|
||||
"gatsby-plugin-google-analytics": "^2.0.20",
|
||||
"gatsby-plugin-manifest": "^2.1.1",
|
||||
"gatsby-plugin-offline": "^2.1.1",
|
||||
"gatsby-plugin-react-helmet": "^3.0.12",
|
||||
"gatsby-plugin-sharp": "^2.1.3",
|
||||
"gatsby-plugin-typography": "^2.2.13",
|
||||
"gatsby-remark-copy-linked-files": "^2.0.13",
|
||||
"gatsby-remark-images": "^3.0.14",
|
||||
"gatsby-remark-prismjs": "^3.2.9",
|
||||
"gatsby-remark-responsive-iframe": "^2.1.1",
|
||||
"gatsby-remark-smartypants": "^2.0.9",
|
||||
"gatsby-source-filesystem": "^2.0.38",
|
||||
"gatsby-transformer-remark": "^2.3.12",
|
||||
"gatsby-transformer-sharp": "^2.1.21",
|
||||
"prismjs": "^1.16.0",
|
||||
"react": "^16.8.6",
|
||||
"react-dom": "^16.8.6",
|
||||
"react-helmet": "^5.2.1",
|
||||
"react-typography": "^0.16.19",
|
||||
"typeface-merriweather": "0.0.72",
|
||||
"typeface-montserrat": "0.0.54",
|
||||
"typography": "^0.16.19",
|
||||
"typography-theme-wordpress-2016": "^0.16.19"
|
||||
},
|
||||
"devDependencies": {
|
||||
"prettier": "^1.17.1"
|
||||
},
|
||||
"homepage": "https://github.com/gatsbyjs/gatsby-starter-blog#readme",
|
||||
"keywords": [
|
||||
"gatsby"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "n/a",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/gatsbyjs/gatsby-starter-blog.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "gatsby build",
|
||||
"develop": "gatsby develop",
|
||||
"format": "prettier --write src/**/*.{js,jsx}",
|
||||
"start": "npm run develop",
|
||||
"serve": "gatsby serve",
|
||||
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\""
|
||||
}
|
||||
}
|
||||
75
src/components/bio.js
Normal file
75
src/components/bio.js
Normal file
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
* Bio component that queries for data
|
||||
* with Gatsby's StaticQuery component
|
||||
*
|
||||
* See: https://www.gatsbyjs.org/docs/static-query/
|
||||
*/
|
||||
|
||||
import React from "react"
|
||||
import { StaticQuery, graphql } from "gatsby"
|
||||
import Image from "gatsby-image"
|
||||
|
||||
import { rhythm } from "../utils/typography"
|
||||
|
||||
function Bio() {
|
||||
return (
|
||||
<StaticQuery
|
||||
query={bioQuery}
|
||||
render={data => {
|
||||
const { author, social } = data.site.siteMetadata
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
display: `flex`,
|
||||
marginBottom: rhythm(2.5),
|
||||
}}
|
||||
>
|
||||
<Image
|
||||
fixed={data.avatar.childImageSharp.fixed}
|
||||
alt={author}
|
||||
style={{
|
||||
marginRight: rhythm(1 / 2),
|
||||
marginBottom: 0,
|
||||
minWidth: 50,
|
||||
borderRadius: `100%`,
|
||||
}}
|
||||
imgStyle={{
|
||||
borderRadius: `50%`,
|
||||
}}
|
||||
/>
|
||||
<p>
|
||||
Written by <strong>{author}</strong> who lives and works in San
|
||||
Francisco building useful things.
|
||||
{` `}
|
||||
<a href={`https://twitter.com/${social.twitter}`}>
|
||||
You should follow him on Twitter
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
const bioQuery = graphql`
|
||||
query BioQuery {
|
||||
avatar: file(absolutePath: { regex: "/profile-pic.jpg/" }) {
|
||||
childImageSharp {
|
||||
fixed(width: 50, height: 50) {
|
||||
...GatsbyImageSharpFixed
|
||||
}
|
||||
}
|
||||
}
|
||||
site {
|
||||
siteMetadata {
|
||||
author
|
||||
social {
|
||||
twitter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
export default Bio
|
||||
75
src/components/layout.js
Normal file
75
src/components/layout.js
Normal file
@@ -0,0 +1,75 @@
|
||||
import React from "react"
|
||||
import { Link } from "gatsby"
|
||||
|
||||
import { rhythm, scale } from "../utils/typography"
|
||||
|
||||
class Layout extends React.Component {
|
||||
render() {
|
||||
const { location, title, children } = this.props
|
||||
const rootPath = `${__PATH_PREFIX__}/`
|
||||
let header
|
||||
|
||||
if (location.pathname === rootPath) {
|
||||
header = (
|
||||
<h1
|
||||
style={{
|
||||
...scale(1.5),
|
||||
marginBottom: rhythm(1.5),
|
||||
marginTop: 0,
|
||||
}}
|
||||
>
|
||||
<Link
|
||||
style={{
|
||||
boxShadow: `none`,
|
||||
textDecoration: `none`,
|
||||
color: `inherit`,
|
||||
}}
|
||||
to={`/`}
|
||||
>
|
||||
{title}
|
||||
</Link>
|
||||
</h1>
|
||||
)
|
||||
} else {
|
||||
header = (
|
||||
<h3
|
||||
style={{
|
||||
fontFamily: `Montserrat, sans-serif`,
|
||||
marginTop: 0,
|
||||
}}
|
||||
>
|
||||
<Link
|
||||
style={{
|
||||
boxShadow: `none`,
|
||||
textDecoration: `none`,
|
||||
color: `inherit`,
|
||||
}}
|
||||
to={`/`}
|
||||
>
|
||||
{title}
|
||||
</Link>
|
||||
</h3>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
marginLeft: `auto`,
|
||||
marginRight: `auto`,
|
||||
maxWidth: rhythm(24),
|
||||
padding: `${rhythm(1.5)} ${rhythm(3 / 4)}`,
|
||||
}}
|
||||
>
|
||||
<header>{header}</header>
|
||||
<main>{children}</main>
|
||||
<footer>
|
||||
© {new Date().getFullYear()}, Built with
|
||||
{` `}
|
||||
<a href="https://www.gatsbyjs.org">Gatsby</a>
|
||||
</footer>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default Layout
|
||||
88
src/components/seo.js
Normal file
88
src/components/seo.js
Normal file
@@ -0,0 +1,88 @@
|
||||
/**
|
||||
* SEO component that queries for data with
|
||||
* Gatsby's useStaticQuery React hook
|
||||
*
|
||||
* See: https://www.gatsbyjs.org/docs/use-static-query/
|
||||
*/
|
||||
|
||||
import React from "react"
|
||||
import PropTypes from "prop-types"
|
||||
import Helmet from "react-helmet"
|
||||
import { useStaticQuery, graphql } from "gatsby"
|
||||
|
||||
function SEO({ description, lang, meta, title }) {
|
||||
const { site } = useStaticQuery(
|
||||
graphql`
|
||||
query {
|
||||
site {
|
||||
siteMetadata {
|
||||
title
|
||||
description
|
||||
author
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
)
|
||||
|
||||
const metaDescription = description || site.siteMetadata.description
|
||||
|
||||
return (
|
||||
<Helmet
|
||||
htmlAttributes={{
|
||||
lang,
|
||||
}}
|
||||
title={title}
|
||||
titleTemplate={`%s | ${site.siteMetadata.title}`}
|
||||
meta={[
|
||||
{
|
||||
name: `description`,
|
||||
content: metaDescription,
|
||||
},
|
||||
{
|
||||
property: `og:title`,
|
||||
content: title,
|
||||
},
|
||||
{
|
||||
property: `og:description`,
|
||||
content: metaDescription,
|
||||
},
|
||||
{
|
||||
property: `og:type`,
|
||||
content: `website`,
|
||||
},
|
||||
{
|
||||
name: `twitter:card`,
|
||||
content: `summary`,
|
||||
},
|
||||
{
|
||||
name: `twitter:creator`,
|
||||
content: site.siteMetadata.author,
|
||||
},
|
||||
{
|
||||
name: `twitter:title`,
|
||||
content: title,
|
||||
},
|
||||
{
|
||||
name: `twitter:description`,
|
||||
content: metaDescription,
|
||||
},
|
||||
].concat(meta)}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
SEO.defaultProps = {
|
||||
lang: `en`,
|
||||
meta: [],
|
||||
description: ``,
|
||||
}
|
||||
|
||||
SEO.propTypes = {
|
||||
description: PropTypes.string,
|
||||
lang: PropTypes.string,
|
||||
meta: PropTypes.arrayOf(PropTypes.object),
|
||||
title: PropTypes.string.isRequired,
|
||||
}
|
||||
|
||||
export default SEO
|
||||
32
src/pages/404.js
Normal file
32
src/pages/404.js
Normal file
@@ -0,0 +1,32 @@
|
||||
import React from "react"
|
||||
import { graphql } from "gatsby"
|
||||
|
||||
import Layout from "../components/layout"
|
||||
import SEO from "../components/seo"
|
||||
|
||||
class NotFoundPage extends React.Component {
|
||||
render() {
|
||||
const { data } = this.props
|
||||
const siteTitle = data.site.siteMetadata.title
|
||||
|
||||
return (
|
||||
<Layout location={this.props.location} title={siteTitle}>
|
||||
<SEO title="404: Not Found" />
|
||||
<h1>Not Found</h1>
|
||||
<p>You just hit a route that doesn't exist... the sadness.</p>
|
||||
</Layout>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default NotFoundPage
|
||||
|
||||
export const pageQuery = graphql`
|
||||
query {
|
||||
site {
|
||||
siteMetadata {
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
71
src/pages/index.js
Normal file
71
src/pages/index.js
Normal file
@@ -0,0 +1,71 @@
|
||||
import React from "react"
|
||||
import { Link, graphql } from "gatsby"
|
||||
|
||||
import Bio from "../components/bio"
|
||||
import Layout from "../components/layout"
|
||||
import SEO from "../components/seo"
|
||||
import { rhythm } from "../utils/typography"
|
||||
|
||||
class BlogIndex extends React.Component {
|
||||
render() {
|
||||
const { data } = this.props
|
||||
const siteTitle = data.site.siteMetadata.title
|
||||
const posts = data.allMarkdownRemark.edges
|
||||
|
||||
return (
|
||||
<Layout location={this.props.location} title={siteTitle}>
|
||||
<SEO title="All posts" />
|
||||
<Bio />
|
||||
{posts.map(({ node }) => {
|
||||
const title = node.frontmatter.title || node.fields.slug
|
||||
return (
|
||||
<div key={node.fields.slug}>
|
||||
<h3
|
||||
style={{
|
||||
marginBottom: rhythm(1 / 4),
|
||||
}}
|
||||
>
|
||||
<Link style={{ boxShadow: `none` }} to={node.fields.slug}>
|
||||
{title}
|
||||
</Link>
|
||||
</h3>
|
||||
<small>{node.frontmatter.date}</small>
|
||||
<p
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: node.frontmatter.description || node.excerpt,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</Layout>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default BlogIndex
|
||||
|
||||
export const pageQuery = graphql`
|
||||
query {
|
||||
site {
|
||||
siteMetadata {
|
||||
title
|
||||
}
|
||||
}
|
||||
allMarkdownRemark(sort: { fields: [frontmatter___date], order: DESC }) {
|
||||
edges {
|
||||
node {
|
||||
excerpt
|
||||
fields {
|
||||
slug
|
||||
}
|
||||
frontmatter {
|
||||
date(formatString: "MMMM DD, YYYY")
|
||||
title
|
||||
description
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
90
src/templates/blog-post.js
Normal file
90
src/templates/blog-post.js
Normal file
@@ -0,0 +1,90 @@
|
||||
import React from "react"
|
||||
import { Link, graphql } from "gatsby"
|
||||
|
||||
import Bio from "../components/bio"
|
||||
import Layout from "../components/layout"
|
||||
import SEO from "../components/seo"
|
||||
import { rhythm, scale } from "../utils/typography"
|
||||
|
||||
class BlogPostTemplate extends React.Component {
|
||||
render() {
|
||||
const post = this.props.data.markdownRemark
|
||||
const siteTitle = this.props.data.site.siteMetadata.title
|
||||
const { previous, next } = this.props.pageContext
|
||||
|
||||
return (
|
||||
<Layout location={this.props.location} title={siteTitle}>
|
||||
<SEO
|
||||
title={post.frontmatter.title}
|
||||
description={post.frontmatter.description || post.excerpt}
|
||||
/>
|
||||
<h1>{post.frontmatter.title}</h1>
|
||||
<p
|
||||
style={{
|
||||
...scale(-1 / 5),
|
||||
display: `block`,
|
||||
marginBottom: rhythm(1),
|
||||
marginTop: rhythm(-1),
|
||||
}}
|
||||
>
|
||||
{post.frontmatter.date}
|
||||
</p>
|
||||
<div dangerouslySetInnerHTML={{ __html: post.html }} />
|
||||
<hr
|
||||
style={{
|
||||
marginBottom: rhythm(1),
|
||||
}}
|
||||
/>
|
||||
<Bio />
|
||||
|
||||
<ul
|
||||
style={{
|
||||
display: `flex`,
|
||||
flexWrap: `wrap`,
|
||||
justifyContent: `space-between`,
|
||||
listStyle: `none`,
|
||||
padding: 0,
|
||||
}}
|
||||
>
|
||||
<li>
|
||||
{previous && (
|
||||
<Link to={previous.fields.slug} rel="prev">
|
||||
← {previous.frontmatter.title}
|
||||
</Link>
|
||||
)}
|
||||
</li>
|
||||
<li>
|
||||
{next && (
|
||||
<Link to={next.fields.slug} rel="next">
|
||||
{next.frontmatter.title} →
|
||||
</Link>
|
||||
)}
|
||||
</li>
|
||||
</ul>
|
||||
</Layout>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default BlogPostTemplate
|
||||
|
||||
export const pageQuery = graphql`
|
||||
query BlogPostBySlug($slug: String!) {
|
||||
site {
|
||||
siteMetadata {
|
||||
title
|
||||
author
|
||||
}
|
||||
}
|
||||
markdownRemark(fields: { slug: { eq: $slug } }) {
|
||||
id
|
||||
excerpt(pruneLength: 160)
|
||||
html
|
||||
frontmatter {
|
||||
title
|
||||
date(formatString: "MMMM DD, YYYY")
|
||||
description
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
23
src/utils/typography.js
Normal file
23
src/utils/typography.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import Typography from "typography"
|
||||
import Wordpress2016 from "typography-theme-wordpress-2016"
|
||||
|
||||
Wordpress2016.overrideThemeStyles = () => {
|
||||
return {
|
||||
"a.gatsby-resp-image-link": {
|
||||
boxShadow: `none`,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
delete Wordpress2016.googleFonts
|
||||
|
||||
const typography = new Typography(Wordpress2016)
|
||||
|
||||
// Hot reload typography in development.
|
||||
if (process.env.NODE_ENV !== `production`) {
|
||||
typography.injectStyles()
|
||||
}
|
||||
|
||||
export default typography
|
||||
export const rhythm = typography.rhythm
|
||||
export const scale = typography.scale
|
||||
BIN
static/favicon.ico
Normal file
BIN
static/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 198 B |
2
static/robots.txt
Normal file
2
static/robots.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
User-agent: *
|
||||
Disallow:
|
||||
Reference in New Issue
Block a user