Merge remote-tracking branch 'origin/v2'
This commit is contained in:
commit
cab6f25de7
11 changed files with 9566 additions and 9591 deletions
4
.babelrc
4
.babelrc
|
|
@ -1,4 +0,0 @@
|
||||||
{
|
|
||||||
"presets": ['react', 'es2015', 'stage-1'],
|
|
||||||
"plugins": ['add-module-exports']
|
|
||||||
}
|
|
||||||
|
|
@ -45,6 +45,18 @@ module.exports = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
`gatsby-plugin-feed`,
|
`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: `src/assets/gatsby-icon.png`,
|
||||||
|
},
|
||||||
|
},
|
||||||
`gatsby-plugin-offline`,
|
`gatsby-plugin-offline`,
|
||||||
`gatsby-plugin-react-helmet`,
|
`gatsby-plugin-react-helmet`,
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ const Promise = require('bluebird')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const { createFilePath } = require('gatsby-source-filesystem')
|
const { createFilePath } = require('gatsby-source-filesystem')
|
||||||
|
|
||||||
exports.createPages = ({ graphql, boundActionCreators }) => {
|
exports.createPages = ({ graphql, actions }) => {
|
||||||
const { createPage } = boundActionCreators
|
const { createPage } = actions
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const blogPost = path.resolve('./src/templates/blog-post.js')
|
const blogPost = path.resolve('./src/templates/blog-post.js')
|
||||||
|
|
@ -54,8 +54,8 @@ exports.createPages = ({ graphql, boundActionCreators }) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.onCreateNode = ({ node, boundActionCreators, getNode }) => {
|
exports.onCreateNode = ({ node, actions, getNode }) => {
|
||||||
const { createNodeField } = boundActionCreators
|
const { createNodeField } = actions
|
||||||
|
|
||||||
if (node.internal.type === `MarkdownRemark`) {
|
if (node.internal.type === `MarkdownRemark`) {
|
||||||
const value = createFilePath({ node, getNode })
|
const value = createFilePath({ node, getNode })
|
||||||
|
|
|
||||||
19038
package-lock.json
generated
19038
package-lock.json
generated
File diff suppressed because it is too large
Load diff
46
package.json
46
package.json
|
|
@ -7,32 +7,38 @@
|
||||||
"url": "https://github.com/gatsbyjs/gatsby-starter-blog/issues"
|
"url": "https://github.com/gatsbyjs/gatsby-starter-blog/issues"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"gatsby": "^1.9.250",
|
"gatsby": "^2.0.0",
|
||||||
"gatsby-link": "^1.6.39",
|
"gatsby-plugin-feed": "^2.0.5",
|
||||||
"gatsby-plugin-feed": "^1.3.20",
|
"gatsby-plugin-google-analytics": "^2.0.5",
|
||||||
"gatsby-plugin-google-analytics": "^1.0.29",
|
"gatsby-plugin-manifest": "^2.0.2",
|
||||||
"gatsby-plugin-offline": "^1.0.15",
|
"gatsby-plugin-offline": "^2.0.5",
|
||||||
"gatsby-plugin-react-helmet": "^1.0.8",
|
"gatsby-plugin-react-helmet": "^3.0.0",
|
||||||
"gatsby-plugin-sharp": "^1.6.42",
|
"gatsby-plugin-sharp": "^2.0.5",
|
||||||
"gatsby-plugin-typography": "^1.7.18",
|
"gatsby-plugin-typography": "^2.2.0",
|
||||||
"gatsby-remark-copy-linked-files": "^1.5.31",
|
"gatsby-remark-copy-linked-files": "^2.0.5",
|
||||||
"gatsby-remark-images": "^1.5.61",
|
"gatsby-remark-images": "^2.0.1",
|
||||||
"gatsby-remark-prismjs": "^1.2.24",
|
"gatsby-remark-prismjs": "^3.0.0",
|
||||||
"gatsby-remark-responsive-iframe": "^1.4.18",
|
"gatsby-remark-responsive-iframe": "^2.0.5",
|
||||||
"gatsby-remark-smartypants": "^1.4.12",
|
"gatsby-remark-smartypants": "^2.0.5",
|
||||||
"gatsby-source-filesystem": "^1.5.31",
|
"gatsby-source-filesystem": "^2.0.1",
|
||||||
"gatsby-transformer-remark": "^1.7.40",
|
"gatsby-transformer-remark": "^2.1.1",
|
||||||
"gatsby-transformer-sharp": "^1.6.22",
|
"gatsby-transformer-sharp": "^2.1.1",
|
||||||
"lodash": "^4.17.5",
|
"lodash": "^4.17.11",
|
||||||
|
"prismjs": "^1.15.0",
|
||||||
|
"react": "^16.5.1",
|
||||||
|
"react-dom": "^16.5.1",
|
||||||
|
"react-helmet": "^5.2.0",
|
||||||
|
"react-typography": "^0.16.13",
|
||||||
"typeface-merriweather": "0.0.43",
|
"typeface-merriweather": "0.0.43",
|
||||||
"typeface-montserrat": "0.0.43",
|
"typeface-montserrat": "0.0.43",
|
||||||
|
"typography": "^0.16.17",
|
||||||
"typography-theme-wordpress-2016": "^0.15.10"
|
"typography-theme-wordpress-2016": "^0.15.10"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^4.19.1",
|
"eslint": "^4.19.1",
|
||||||
"eslint-plugin-react": "^7.7.0",
|
"eslint-plugin-react": "^7.11.1",
|
||||||
"gh-pages": "^1.1.0",
|
"gh-pages": "^1.2.0",
|
||||||
"prettier": "^1.12.0"
|
"prettier": "^1.14.2"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/gatsbyjs/gatsby-starter-blog#readme",
|
"homepage": "https://github.com/gatsbyjs/gatsby-starter-blog#readme",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|
|
||||||
BIN
src/assets/gatsby-icon.png
Normal file
BIN
src/assets/gatsby-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
|
|
@ -1,18 +1,14 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import Link from 'gatsby-link'
|
import { Link } from 'gatsby'
|
||||||
|
|
||||||
import { rhythm, scale } from '../utils/typography'
|
import { rhythm, scale } from '../utils/typography'
|
||||||
|
|
||||||
class Template extends React.Component {
|
class Template extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
const { location, children } = this.props
|
const { location, children } = this.props
|
||||||
|
const rootPath = `${__PATH_PREFIX__}/`
|
||||||
let header
|
let header
|
||||||
|
|
||||||
let rootPath = `/`
|
|
||||||
if (typeof __PREFIX_PATHS__ !== `undefined` && __PREFIX_PATHS__) {
|
|
||||||
rootPath = __PATH_PREFIX__ + `/`
|
|
||||||
}
|
|
||||||
|
|
||||||
if (location.pathname === rootPath) {
|
if (location.pathname === rootPath) {
|
||||||
header = (
|
header = (
|
||||||
<h1
|
<h1
|
||||||
|
|
@ -66,7 +62,7 @@ class Template extends React.Component {
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{header}
|
{header}
|
||||||
{children()}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 3.3 KiB |
|
|
@ -1,19 +1,28 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import Link from 'gatsby-link'
|
import { Link, graphql } from 'gatsby'
|
||||||
import get from 'lodash/get'
|
import get from 'lodash/get'
|
||||||
import Helmet from 'react-helmet'
|
import Helmet from 'react-helmet'
|
||||||
|
|
||||||
import Bio from '../components/Bio'
|
import Bio from '../components/Bio'
|
||||||
|
import Layout from '../components/layout'
|
||||||
import { rhythm } from '../utils/typography'
|
import { rhythm } from '../utils/typography'
|
||||||
|
|
||||||
class BlogIndex extends React.Component {
|
class BlogIndex extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
const siteTitle = get(this, 'props.data.site.siteMetadata.title')
|
const siteTitle = get(this, 'props.data.site.siteMetadata.title')
|
||||||
|
const siteDescription = get(
|
||||||
|
this,
|
||||||
|
'props.data.site.siteMetadata.description'
|
||||||
|
)
|
||||||
const posts = get(this, 'props.data.allMarkdownRemark.edges')
|
const posts = get(this, 'props.data.allMarkdownRemark.edges')
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<Layout location={this.props.location}>
|
||||||
<Helmet title={siteTitle} />
|
<Helmet
|
||||||
|
htmlAttributes={{ lang: 'en' }}
|
||||||
|
meta={[{ name: 'description', content: siteDescription }]}
|
||||||
|
title={siteTitle}
|
||||||
|
/>
|
||||||
<Bio />
|
<Bio />
|
||||||
{posts.map(({ node }) => {
|
{posts.map(({ node }) => {
|
||||||
const title = get(node, 'frontmatter.title') || node.fields.slug
|
const title = get(node, 'frontmatter.title') || node.fields.slug
|
||||||
|
|
@ -33,7 +42,7 @@ class BlogIndex extends React.Component {
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
</div>
|
</Layout>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -41,10 +50,11 @@ class BlogIndex extends React.Component {
|
||||||
export default BlogIndex
|
export default BlogIndex
|
||||||
|
|
||||||
export const pageQuery = graphql`
|
export const pageQuery = graphql`
|
||||||
query IndexQuery {
|
query {
|
||||||
site {
|
site {
|
||||||
siteMetadata {
|
siteMetadata {
|
||||||
title
|
title
|
||||||
|
description
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
allMarkdownRemark(sort: { fields: [frontmatter___date], order: DESC }) {
|
allMarkdownRemark(sort: { fields: [frontmatter___date], order: DESC }) {
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,26 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import Helmet from 'react-helmet'
|
import Helmet from 'react-helmet'
|
||||||
import Link from 'gatsby-link'
|
import { Link,graphql } from 'gatsby'
|
||||||
import get from 'lodash/get'
|
import get from 'lodash/get'
|
||||||
|
|
||||||
import Bio from '../components/Bio'
|
import Bio from '../components/Bio'
|
||||||
|
import Layout from '../components/layout'
|
||||||
import { rhythm, scale } from '../utils/typography'
|
import { rhythm, scale } from '../utils/typography'
|
||||||
|
|
||||||
class BlogPostTemplate extends React.Component {
|
class BlogPostTemplate extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
const post = this.props.data.markdownRemark
|
const post = this.props.data.markdownRemark
|
||||||
const siteTitle = get(this.props, 'data.site.siteMetadata.title')
|
const siteTitle = get(this.props, 'data.site.siteMetadata.title')
|
||||||
const { previous, next } = this.props.pathContext
|
const siteDescription = post.excerpt
|
||||||
|
const { previous, next } = this.props.pageContext
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<Layout location={this.props.location}>
|
||||||
<Helmet title={`${post.frontmatter.title} | ${siteTitle}`} />
|
<Helmet
|
||||||
|
htmlAttributes={{ lang: 'en' }}
|
||||||
|
meta={[{ name: 'description', content: siteDescription }]}
|
||||||
|
title={`${post.frontmatter.title} | ${siteTitle}`}
|
||||||
|
/>
|
||||||
<h1>{post.frontmatter.title}</h1>
|
<h1>{post.frontmatter.title}</h1>
|
||||||
<p
|
<p
|
||||||
style={{
|
style={{
|
||||||
|
|
@ -60,7 +66,7 @@ class BlogPostTemplate extends React.Component {
|
||||||
}
|
}
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</Layout>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -77,6 +83,7 @@ export const pageQuery = graphql`
|
||||||
}
|
}
|
||||||
markdownRemark(fields: { slug: { eq: $slug } }) {
|
markdownRemark(fields: { slug: { eq: $slug } }) {
|
||||||
id
|
id
|
||||||
|
excerpt
|
||||||
html
|
html
|
||||||
frontmatter {
|
frontmatter {
|
||||||
title
|
title
|
||||||
|
|
|
||||||
|
|
@ -17,3 +17,5 @@ if (process.env.NODE_ENV !== 'production') {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default typography
|
export default typography
|
||||||
|
export const rhythm = typography.rhythm
|
||||||
|
export const scale = typography.scale
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue