diff --git a/gatsby-node.js b/gatsby-node.js index 8496813..72ad90d 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -1,4 +1,4 @@ -const _ = require("lodash") +const _ = require('lodash') const Promise = require('bluebird') const path = require('path') const { createFilePath } = require('gatsby-source-filesystem') @@ -7,7 +7,7 @@ exports.createPages = ({ graphql, boundActionCreators }) => { const { createPage } = boundActionCreators return new Promise((resolve, reject) => { - const blogPost = path.resolve("./src/templates/blog-post.js") + const blogPost = path.resolve('./src/templates/blog-post.js') resolve( graphql( ` @@ -15,8 +15,8 @@ exports.createPages = ({ graphql, boundActionCreators }) => { allMarkdownRemark(limit: 1000) { edges { node { - frontmatter { - path + fields { + slug } } } @@ -32,10 +32,10 @@ exports.createPages = ({ graphql, boundActionCreators }) => { // Create blog posts pages. _.each(result.data.allMarkdownRemark.edges, edge => { createPage({ - path: edge.node.frontmatter.path, + path: edge.node.fields.slug, component: blogPost, context: { - path: edge.node.frontmatter.path, + slug: edge.node.fields.slug, }, }) }) diff --git a/package.json b/package.json index 6bc41ca..259a9ec 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "dev": "gatsby develop", "lint": "./node_modules/.bin/eslint --ext .js,.jsx --ignore-pattern public .", "test": "echo \"Error: no test specified\" && exit 1", - "format": "prettier --trailing-comma es5 --no-semi --single-quote --write 'src/**/*.js'", + "format": "prettier --trailing-comma es5 --no-semi --single-quote --write 'src/**/*.js' 'src/**/*.md'", "develop": "gatsby develop", "build": "gatsby build", "deploy": "gatsby build --prefix-paths && gh-pages -d public", diff --git a/src/pages/2015-05-01-hello-world/index.md b/src/pages/2015-05-01-hello-world/index.md deleted file mode 100644 index 7b7d8ca..0000000 --- a/src/pages/2015-05-01-hello-world/index.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: Hello World -date: "2015-05-01T22:12:03.284Z" -path: "/hello-world/" ---- - -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. - -![Chinese Salty Egg](./salty_egg.jpg) diff --git a/src/pages/2015-05-06-my-second-post/index.md b/src/pages/2015-05-06-my-second-post/index.md deleted file mode 100644 index a6a4b97..0000000 --- a/src/pages/2015-05-06-my-second-post/index.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: My Second Post! -date: "2015-05-06T23:46:37.121Z" -path: "/my-second-post/" ---- - -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. diff --git a/src/pages/2015-05-28-hi-folks/index.md b/src/pages/2015-05-28-hi-folks/index.md deleted file mode 100644 index 65dc6b0..0000000 --- a/src/pages/2015-05-28-hi-folks/index.md +++ /dev/null @@ -1,117 +0,0 @@ ---- -title: New Beginnings -date: "2015-05-28T22:40:32.169Z" -path: "/hi-folks/" ---- - -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. diff --git a/src/pages/hello-world/index.md b/src/pages/hello-world/index.md new file mode 100644 index 0000000..2d488dd --- /dev/null +++ b/src/pages/hello-world/index.md @@ -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. + +![Chinese Salty Egg](./salty_egg.jpg) diff --git a/src/pages/2015-05-01-hello-world/salty_egg.jpg b/src/pages/hello-world/salty_egg.jpg similarity index 100% rename from src/pages/2015-05-01-hello-world/salty_egg.jpg rename to src/pages/hello-world/salty_egg.jpg diff --git a/src/pages/hi-folks/index.md b/src/pages/hi-folks/index.md new file mode 100644 index 0000000..07e5ced --- /dev/null +++ b/src/pages/hi-folks/index.md @@ -0,0 +1,107 @@ +--- +title: New Beginnings +date: "2015-05-28T22:40:32.169Z" +--- + +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. diff --git a/src/pages/index.js b/src/pages/index.js index 626b617..3df32df 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -15,28 +15,23 @@ class BlogIndex extends React.Component {
- {posts.map(post => { - if (post.node.frontmatter.path !== '/404/') { - const title = get(post, 'node.frontmatter.title') || post.node.path - return ( -
-

- - {title} - -

- {post.node.frontmatter.date} -

-

- ) - } + {posts.map(({ node }) => { + const title = get(node, 'frontmatter.title') || node.fields.slug + return ( +
+

+ + {title} + +

+ {node.frontmatter.date} +

+

+ ) })}
) @@ -56,11 +51,11 @@ export const pageQuery = graphql` edges { node { excerpt - frontmatter { - path - date(formatString: "DD MMMM, YYYY") + fields { + slug } frontmatter { + date(formatString: "DD MMMM, YYYY") title } } diff --git a/src/pages/my-second-post/index.md b/src/pages/my-second-post/index.md new file mode 100644 index 0000000..d19e92d --- /dev/null +++ b/src/pages/my-second-post/index.md @@ -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. diff --git a/src/templates/blog-post.js b/src/templates/blog-post.js index 9aa5ada..c227074 100644 --- a/src/templates/blog-post.js +++ b/src/templates/blog-post.js @@ -39,14 +39,14 @@ class BlogPostTemplate extends React.Component { export default BlogPostTemplate export const pageQuery = graphql` - query BlogPostByPath($path: String!) { + query BlogPostBySlug($slug: String!) { site { siteMetadata { title author } } - markdownRemark(frontmatter: { path: { eq: $path } }) { + markdownRemark(fields: { slug: { eq: $slug } }) { id html frontmatter {