Update starter to latest canary
This commit is contained in:
parent
1d2329c1c9
commit
6a806c21cd
8 changed files with 1295 additions and 1624 deletions
|
|
@ -11,32 +11,29 @@ module.exports = {
|
|||
name: "pages",
|
||||
},
|
||||
},
|
||||
`gatsby-transformer-remark`,
|
||||
`gatsby-transformer-sharp`,
|
||||
{
|
||||
resolve: `gatsby-typegen-remark`,
|
||||
resolve: `gatsby-transformer-remark`,
|
||||
options: {
|
||||
plugins: [
|
||||
{
|
||||
resolve: `gatsby-typegen-remark-responsive-image`,
|
||||
resolve: `gatsby-remark-responsive-image`,
|
||||
options: {
|
||||
maxWidth: 590,
|
||||
},
|
||||
},
|
||||
{
|
||||
resolve: `gatsby-typegen-remark-responsive-iframe`,
|
||||
resolve: `gatsby-remark-responsive-iframe`,
|
||||
options: {
|
||||
wrapperStyle: `margin-bottom: 1.0725rem`,
|
||||
},
|
||||
},
|
||||
"gatsby-typegen-remark-prismjs",
|
||||
"gatsby-typegen-remark-copy-linked-files",
|
||||
"gatsby-typegen-remark-smartypants",
|
||||
"gatsby-remark-prismjs",
|
||||
"gatsby-remark-copy-linked-files",
|
||||
"gatsby-remark-smartypants",
|
||||
],
|
||||
},
|
||||
},
|
||||
`gatsby-typegen-filesystem`,
|
||||
`gatsby-typegen-sharp`,
|
||||
`gatsby-transformer-sharp`,
|
||||
`gatsby-plugin-sharp`,
|
||||
{
|
||||
resolve: `gatsby-plugin-google-analytics`,
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ exports.createPages = ({ graphql, boundActionCreators }) => {
|
|||
return new Promise((resolve, reject) => {
|
||||
const pages = []
|
||||
const blogPost = path.resolve("./src/templates/template-blog-post.js")
|
||||
resolve(
|
||||
graphql(
|
||||
`
|
||||
{
|
||||
|
|
@ -38,22 +39,21 @@ exports.createPages = ({ graphql, boundActionCreators }) => {
|
|||
},
|
||||
})
|
||||
})
|
||||
|
||||
resolve()
|
||||
})
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
// Add custom url pathname for blog posts.
|
||||
exports.onNodeCreate = ({ node, boundActionCreators, getNode }) => {
|
||||
const { updateNode } = boundActionCreators
|
||||
if (node.type === `File` && typeof node.slug === "undefined") {
|
||||
if (node.internal.type === `File` && typeof node.slug === "undefined") {
|
||||
const parsedFilePath = path.parse(node.relativePath)
|
||||
const slug = `/${parsedFilePath.dir}/`
|
||||
node.slug = slug
|
||||
updateNode(node)
|
||||
} else if (
|
||||
node.type === `MarkdownRemark` &&
|
||||
node.internal.type === `MarkdownRemark` &&
|
||||
typeof node.slug === "undefined"
|
||||
) {
|
||||
const fileNode = getNode(node.parent)
|
||||
|
|
|
|||
33
package.json
33
package.json
|
|
@ -7,24 +7,21 @@
|
|||
"url": "https://github.com/gatsbyjs/gatsby-starter-blog/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"gatsby": "1.0.0-alpha13",
|
||||
"gatsby-link": "1.0.0-alpha13",
|
||||
"gatsby-transformer-remark": "1.0.0-alpha13",
|
||||
"gatsby-transformer-sharp": "1.0.0-alpha13",
|
||||
"gatsby-plugin-google-analytics": "1.0.0-alpha13",
|
||||
"gatsby-plugin-manifest": "1.0.0-alpha13",
|
||||
"gatsby-plugin-offline": "1.0.0-alpha13",
|
||||
"gatsby-plugin-preact": "1.0.0-alpha13",
|
||||
"gatsby-plugin-sharp": "1.0.0-alpha13",
|
||||
"gatsby-source-filesystem": "1.0.0-alpha13",
|
||||
"gatsby-typegen-filesystem": "1.0.0-alpha13",
|
||||
"gatsby-typegen-remark": "1.0.0-alpha13",
|
||||
"gatsby-typegen-remark-copy-linked-files": "1.0.0-alpha13",
|
||||
"gatsby-typegen-remark-prismjs": "1.0.0-alpha13",
|
||||
"gatsby-typegen-remark-responsive-iframe": "1.0.0-alpha13",
|
||||
"gatsby-typegen-remark-responsive-image": "1.0.0-alpha13",
|
||||
"gatsby-typegen-remark-smartypants": "1.0.0-alpha13",
|
||||
"gatsby-typegen-sharp": "1.0.0-alpha13",
|
||||
"gatsby": "canary",
|
||||
"gatsby-link": "canary",
|
||||
"gatsby-transformer-remark": "canary",
|
||||
"gatsby-transformer-sharp": "canary",
|
||||
"gatsby-plugin-google-analytics": "canary",
|
||||
"gatsby-plugin-manifest": "canary",
|
||||
"gatsby-plugin-offline": "canary",
|
||||
"gatsby-plugin-preact": "canary",
|
||||
"gatsby-plugin-sharp": "canary",
|
||||
"gatsby-source-filesystem": "canary",
|
||||
"gatsby-remark-copy-linked-files": "canary",
|
||||
"gatsby-remark-prismjs": "canary",
|
||||
"gatsby-remark-responsive-iframe": "canary",
|
||||
"gatsby-remark-responsive-image": "canary",
|
||||
"gatsby-remark-smartypants": "canary",
|
||||
"lodash": "^4.15.0",
|
||||
"moment": "^2.14.1",
|
||||
"react-helmet": "^4.0.0",
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ module.exports = React.createClass({
|
|||
</head>
|
||||
<body>
|
||||
<div
|
||||
id="react-mount"
|
||||
id="___gatsby"
|
||||
dangerouslySetInnerHTML={{ __html: this.props.body }}
|
||||
/>
|
||||
{this.props.postBodyComponents}
|
||||
|
|
|
|||
|
|
@ -59,14 +59,14 @@ class Template extends React.Component {
|
|||
}}
|
||||
>
|
||||
{header}
|
||||
{children}
|
||||
{children()}
|
||||
</Container>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Template.propTypes = {
|
||||
children: React.PropTypes.any,
|
||||
children: React.PropTypes.function,
|
||||
location: React.PropTypes.object,
|
||||
route: React.PropTypes.object,
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@ import { rhythm } from "../utils/typography"
|
|||
|
||||
class BlogIndex extends React.Component {
|
||||
render() {
|
||||
console.log(this.props)
|
||||
// console.log("props", this.props)
|
||||
const pageLinks = []
|
||||
const siteTitle = get(this, "props.data.site.siteMetadata.title")
|
||||
const posts = get(this, "props.data.allMarkdownRemark.edges")
|
||||
|
|
@ -49,8 +49,8 @@ BlogIndex.propTypes = {
|
|||
|
||||
export default BlogIndex
|
||||
|
||||
export const pageQuery = `
|
||||
{
|
||||
export const pageQuery = graphql`
|
||||
query IndexQuery {
|
||||
site {
|
||||
siteMetadata {
|
||||
title
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class BlogPostRoute extends React.Component {
|
|||
render() {
|
||||
const post = this.props.data.markdownRemark
|
||||
const siteTitle = get(this.props, "data.site.siteMetadata.title")
|
||||
console.log(this.props)
|
||||
// console.log(this.props)
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
|
@ -40,7 +40,7 @@ class BlogPostRoute extends React.Component {
|
|||
|
||||
export default BlogPostRoute
|
||||
|
||||
export const pageQuery = `
|
||||
export const pageQuery = graphql`
|
||||
query BlogPostByPath($slug: String!) {
|
||||
site {
|
||||
siteMetadata {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue