├── .editorconfig ├── .eslintignore ├── .eslintrc.js ├── .gitignore ├── .prettierrc ├── LICENSE ├── README.md ├── config └── SiteConfig.js ├── gatsby-config.js ├── gatsby-node.js ├── netlify.toml ├── package.json ├── src ├── assets │ └── images │ │ ├── 1200x500.png │ │ ├── 1200x600.JPG │ │ ├── 600x300.jpg │ │ ├── 7758832526_cc8f681e48_c.jpg │ │ ├── bio-photo.jpg │ │ ├── image-alignment-1200x4002.jpg │ │ ├── image-alignment-150x150.jpg │ │ ├── image-alignment-300x200.jpg │ │ ├── image-alignment-580x300.jpg │ │ ├── joshua-earle-234740.jpg │ │ ├── null.png │ │ ├── unsplash-image-1.jpg │ │ ├── unsplash-image-10.jpg │ │ ├── unsplash-image-11.jpg │ │ ├── unsplash-image-2.jpg │ │ ├── unsplash-image-3.jpg │ │ ├── unsplash-image-4.jpg │ │ ├── unsplash-image-5.jpg │ │ ├── unsplash-image-6.jpg │ │ ├── unsplash-image-7.jpg │ │ ├── unsplash-image-8.jpg │ │ └── unsplash-image-9.jpg ├── comments │ ├── markup │ │ ├── markup-html-tags-and-formatting │ │ │ └── comment-1528316381544.md │ │ ├── markup-syntax-highlighting │ │ │ └── comment-1528733989174.md │ │ └── markup-text-readability │ │ │ └── comment-1535554587673.md │ └── post │ │ ├── hello-world │ │ ├── comment-1470942205700.md │ │ ├── comment-1470942247755.md │ │ ├── comment-1470942265819.md │ │ ├── comment-1470942493518.md │ │ ├── comment-1471823346931.md │ │ ├── comment-1471834988411.md │ │ ├── comment-1472786599470.md │ │ ├── comment-1474328950155.md │ │ ├── comment-1500505983331.md │ │ └── comment-1507141538771.md │ │ └── post-future-date │ │ └── comment-1527277069391.md ├── components │ ├── Byline.js │ ├── Comment.js │ ├── Comments.js │ ├── CommentsForm.js │ ├── Footer.js │ ├── Header.js │ ├── Layout.js │ ├── Menu.js │ ├── OverlayMenu.js │ ├── OverlayMenuItems.js │ ├── PageMeta.js │ ├── PageTitle.js │ ├── Pagination.js │ ├── PaginationLink.js │ ├── PostCategories.js │ ├── PostListing.js │ ├── PostPagination.js │ ├── PostTags.js │ └── SkipLinks.js ├── css │ ├── global.css │ └── prism.css ├── pages │ ├── 404.js │ ├── category.js │ ├── comment-success.js │ ├── grid-example.js │ └── tag.js ├── templates │ ├── blog-post.js │ ├── categories.js │ ├── index.js │ └── tags.js ├── test-posts │ ├── 2009-05-15-edge-case-nested-and-mixed-lists.md │ ├── 2009-06-01-edge-case-many-tags.md │ ├── 2009-06-01-edge-case-no-tags.md │ ├── 2009-07-02-edge-case-many-categories.md │ ├── 2009-08-06-edge-case-no-body-content.md │ ├── 2009-09-05-edge-case-no-yaml-title.md │ ├── 2009-10-05-edge-case-title-should-not-overflow-the-content-area.md │ ├── 2009-10-05-edge-case-very-long-title.md │ ├── 2010-01-07-post-modified.md │ ├── 2010-01-07-post-standard.md │ ├── 2010-01-08-post-chat.md │ ├── 2010-02-05-post-notice.md │ ├── 2010-02-05-post-quote.md │ ├── 2010-03-07-post-link.md │ ├── 2010-06-02-post-video-youtube.md │ ├── 2010-08-05-post-cover-image.md │ ├── 2010-08-05-post-image-linked.md │ ├── 2010-08-05-post-image-standard.md │ ├── 2010-08-06-post-image-linked-caption.md │ ├── 2010-08-07-post-image-caption.md │ ├── 2010-09-10-post-twitter-embeds.md │ ├── 2010-10-25-post-future-date.md │ ├── 2012-05-22-markup-text-readability.md │ ├── 2013-01-05-markup-title-with-markup.md │ ├── 2013-01-05-markup-title-with-special-characters.md │ ├── 2013-01-09-markup-text-alignment.md │ ├── 2013-01-10-markup-image-alignment.md │ ├── 2013-01-11-markup-html-tags-and-formatting.md │ ├── 2013-05-22-markup-more-images.md │ ├── 2013-08-16-markup-syntax-highlighting.md │ └── 2018-04-30-hello-world.md └── utils │ ├── colors.js │ ├── fonts.js │ └── presets.js ├── static ├── favicon.ico └── robots.txt ├── staticman.yml └── yarn.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | public 3 | static 4 | .cache 5 | content 6 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "env": { 3 | "browser": true, 4 | "es6": true, 5 | }, 6 | "root": true, 7 | "extends": ["airbnb", "plugin:prettier/recommended"], 8 | "settings": { 9 | "import/core-modules": ["gatsby", "react", "config"] 10 | }, 11 | "plugins": [ 12 | "react", 13 | ], 14 | "globals": { 15 | "graphql": true, 16 | }, 17 | "parserOptions": { 18 | "sourceType": "module", 19 | "ecmaFeatures": { 20 | "experimentalObjectRestSpread": true, 21 | "jsx": true, 22 | }, 23 | }, 24 | "rules": { 25 | "linebreak-style": 0, 26 | "react/prefer-stateless-function": "off", 27 | "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }], 28 | "jsx-a11y/anchor-is-valid": [ 29 | "error", 30 | { 31 | "components": ["Link"], 32 | "specialLink": ["to"], 33 | "aspects": ["noHref", "invalidHref", "preferButton"] 34 | } 35 | ] 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | public 3 | .gatsby-context.js 4 | .DS_Store 5 | .intermediate-representation/ 6 | .cache/ 7 | yarn.lock 8 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "es5", 3 | "semi": false, 4 | "singleQuote": true 5 | } 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 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: -------------------------------------------------------------------------------- 1 | # Jekyll :arrow_right: Gatsby MVP 2 | 3 | Running Gatsby through its paces by trying to import content from an existing Jekyll site. 4 | 5 | See [#1](https://github.com/mmistakes/gatsby-test/issues/1) for more context. 6 | 7 | ## Development 8 | 9 | 1. Install [Yarn](https://yarnpkg.com/en/). 10 | 2. `yarn` 11 | 3. `gatsby develop` 12 | -------------------------------------------------------------------------------- /config/SiteConfig.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | pathPrefix: '/', // Prefix for all links. If you deploy your site to example.com/blog your pathPrefix should be "blog" 3 | siteUrl: `https://awesome-lewin-0d1356.netlify.com`, 4 | title: `Jekyll → Gatsby MVP`, 5 | author: `Michael Rose`, 6 | description: `Test conversion of a Jekyll powered site to Gatsby.`, 7 | } 8 | -------------------------------------------------------------------------------- /gatsby-config.js: -------------------------------------------------------------------------------- 1 | const config = require('./config/SiteConfig') 2 | 3 | const pathPrefix = config.pathPrefix === '/' ? '' : config.pathPrefix 4 | 5 | module.exports = { 6 | siteMetadata: { 7 | title: config.title, 8 | author: config.author, 9 | description: config.description, 10 | siteUrl: config.siteUrl + pathPrefix, 11 | }, 12 | plugins: [ 13 | { 14 | resolve: `gatsby-source-filesystem`, 15 | options: { 16 | path: `${__dirname}/src/pages`, 17 | name: `pages`, 18 | }, 19 | }, 20 | { 21 | resolve: `gatsby-source-filesystem`, 22 | options: { 23 | path: `${__dirname}/src/test-posts`, 24 | name: `test-posts`, 25 | }, 26 | }, 27 | { 28 | resolve: `gatsby-source-filesystem`, 29 | options: { 30 | path: `${__dirname}/src/assets/images`, 31 | name: `images`, 32 | }, 33 | }, 34 | { 35 | resolve: `gatsby-source-filesystem`, 36 | options: { 37 | path: `${__dirname}/src/comments`, 38 | name: `comments`, 39 | }, 40 | }, 41 | { 42 | resolve: `gatsby-transformer-remark`, 43 | options: { 44 | excerpt_separator: ``, 45 | plugins: [ 46 | { 47 | resolve: `gatsby-remark-images`, 48 | options: { 49 | maxWidth: 750, 50 | quality: 90, 51 | }, 52 | }, 53 | { 54 | resolve: `gatsby-remark-responsive-iframe`, 55 | options: { 56 | wrapperStyle: `margin-bottom: 1.0725rem`, 57 | }, 58 | }, 59 | { 60 | resolve: `gatsby-remark-prismjs`, 61 | options: { 62 | classPrefix: `language-`, 63 | inlineCodeMarker: null, 64 | aliases: {}, 65 | }, 66 | }, 67 | { 68 | resolve: `gatsby-remark-custom-blocks`, 69 | options: { 70 | blocks: { 71 | notice: { 72 | classes: `notice`, 73 | title: `optional`, 74 | }, 75 | info: { 76 | classes: `notice info`, 77 | title: `optional`, 78 | }, 79 | warning: { 80 | classes: `notice warning`, 81 | title: `optional`, 82 | }, 83 | danger: { 84 | classes: `notice danger`, 85 | title: `optional`, 86 | }, 87 | success: { 88 | classes: `notice success`, 89 | title: `optional`, 90 | }, 91 | }, 92 | }, 93 | }, 94 | { 95 | resolve: `gatsby-remark-smartypants`, 96 | options: { 97 | dashes: `oldschool`, 98 | }, 99 | }, 100 | `gatsby-remark-copy-linked-files`, 101 | `gatsby-remark-emoji`, 102 | `gatsby-remark-autolink-headers`, 103 | `gatsby-remark-abbr`, 104 | `gatsby-remark-numbered-footnotes`, 105 | ], 106 | }, 107 | }, 108 | `gatsby-remark-source-name`, 109 | `gatsby-plugin-glamor`, 110 | `gatsby-plugin-twitter`, 111 | `gatsby-transformer-sharp`, 112 | `gatsby-plugin-sharp`, 113 | { 114 | resolve: `gatsby-plugin-google-analytics`, 115 | options: { 116 | // trackingId: `ADD YOUR TRACKING ID HERE`, 117 | }, 118 | }, 119 | { 120 | resolve: `gatsby-plugin-feed`, 121 | options: { 122 | query: ` 123 | { 124 | site { 125 | siteMetadata { 126 | title 127 | description 128 | siteUrl 129 | site_url: siteUrl 130 | } 131 | } 132 | } 133 | `, 134 | feeds: [ 135 | { 136 | serialize: ({ query: { site, allMarkdownRemark } }) => { 137 | return allMarkdownRemark.edges.map(edge => { 138 | return Object.assign({}, edge.node.frontmatter, { 139 | description: edge.node.excerpt, 140 | url: site.siteMetadata.siteUrl + edge.node.fields.slug, 141 | guid: site.siteMetadata.siteUrl + edge.node.fields.slug, 142 | custom_elements: [{ 'content:encoded': edge.node.html }], 143 | }) 144 | }) 145 | }, 146 | query: ` 147 | { 148 | allMarkdownRemark( 149 | limit: 20, 150 | sort: { fields: [fields___date], order: DESC }, 151 | filter: { 152 | fields: { 153 | sourceName: { ne: "comments" } 154 | } 155 | } 156 | ) { 157 | edges { 158 | node { 159 | excerpt 160 | html 161 | fields { 162 | slug 163 | date 164 | } 165 | frontmatter { 166 | title 167 | } 168 | } 169 | } 170 | } 171 | } 172 | `, 173 | output: '/rss.xml', 174 | }, 175 | ], 176 | }, 177 | }, 178 | { 179 | resolve: `gatsby-plugin-sitemap`, 180 | options: { 181 | output: `/sitemap.xml`, 182 | // Exclude specific pages or groups of pages using glob parameters 183 | // See: https://github.com/isaacs/minimatch 184 | // The example below will exclude the single `path/to/page` and all routes beginning with `category` 185 | // exclude: ["/category/*", `/path/to/page`], 186 | query: ` 187 | { 188 | site { 189 | siteMetadata { 190 | siteUrl 191 | } 192 | } 193 | 194 | allSitePage { 195 | edges { 196 | node { 197 | path 198 | } 199 | } 200 | } 201 | }`, 202 | }, 203 | }, 204 | `gatsby-plugin-react-helmet`, 205 | `gatsby-plugin-netlify`, 206 | ], 207 | } 208 | -------------------------------------------------------------------------------- /gatsby-node.js: -------------------------------------------------------------------------------- 1 | const _ = require('lodash') 2 | const moment = require('moment') 3 | const Promise = require('bluebird') 4 | const path = require('path') 5 | const { createFilePath } = require('gatsby-source-filesystem') 6 | const { createPaginationPages } = require('gatsby-pagination') 7 | 8 | // Calculate post defaults. 9 | const calculateDefaults = (node, getNode) => { 10 | const defaultSlug = createFilePath({ node, getNode, basePath: `pages` }) 11 | const isPostShaped = defaultSlug.match( 12 | /^\/([\d]{4}-[\d]{2}-[\d]{2})-{1}(.+)\/$/ 13 | ) 14 | 15 | if (isPostShaped) { 16 | const [, defaultDate, defaultTitle] = isPostShaped 17 | return [defaultSlug, defaultTitle, defaultDate] 18 | } 19 | 20 | const [, defaultTitle] = defaultSlug.match(/^\/(.*)\/$/) 21 | const defaultDate = moment().format('YYYY-MM-DD') 22 | return [defaultSlug, defaultTitle, defaultDate] 23 | } 24 | 25 | exports.onCreateNode = ({ node, getNode, actions }) => { 26 | const { createNodeField } = actions 27 | 28 | if (node.internal.type === `MarkdownRemark`) { 29 | try { 30 | if (node.fields.sourceName !== `comments`) { 31 | const [defaultSlug, defaultTitle, defaultDate] = calculateDefaults( 32 | node, 33 | getNode 34 | ) 35 | 36 | const date = node.frontmatter.date || defaultDate 37 | const title = defaultTitle 38 | const { categories } = node.frontmatter 39 | const categoriesPath = categories 40 | .join('/') 41 | .replace(/([a-z])([A-Z])/g, '$1-$2') 42 | .replace(/\s+/g, '-') 43 | .toLowerCase() 44 | const slug = `/${categoriesPath}/${title}/` 45 | 46 | createNodeField({ node, name: `slug`, value: slug }) 47 | createNodeField({ node, name: `date`, value: date }) 48 | } 49 | } catch (ex) { 50 | console.log('Error onCreateNode():', node.fileAbsolutePath, '\n', ex) 51 | throw ex 52 | } 53 | } 54 | } 55 | 56 | exports.createPages = ({ graphql, actions }) => { 57 | const { createPage } = actions 58 | 59 | return new Promise((resolve, reject) => { 60 | const indexPage = path.resolve('./src/templates/index.js') 61 | const blogPostTemplate = path.resolve('./src/templates/blog-post.js') 62 | const categoryPageTemplate = path.resolve('./src/templates/categories.js') 63 | const tagPageTemplate = path.resolve('./src/templates/tags.js') 64 | 65 | resolve( 66 | graphql( 67 | ` 68 | { 69 | allMarkdownRemark( 70 | sort: { fields: [fields___date], order: DESC } 71 | filter: { fields: { sourceName: { ne: "comments" } } } 72 | ) { 73 | edges { 74 | node { 75 | id 76 | excerpt(pruneLength: 280) 77 | timeToRead 78 | fields { 79 | slug 80 | date(formatString: "MMMM DD, YYYY") 81 | } 82 | frontmatter { 83 | title 84 | excerpt 85 | categories 86 | tags 87 | image { 88 | path { 89 | childImageSharp { 90 | fluid(maxWidth: 750, quality: 90) { 91 | base64 92 | aspectRatio 93 | src 94 | srcSet 95 | sizes 96 | } 97 | } 98 | } 99 | cover 100 | } 101 | } 102 | } 103 | } 104 | } 105 | } 106 | ` 107 | ).then(result => { 108 | if (result.errors) { 109 | console.log(result.errors) 110 | reject(result.errors) 111 | } 112 | 113 | const posts = result.data.allMarkdownRemark.edges 114 | 115 | // Create post pages 116 | _.each(posts, (post, index) => { 117 | const previous = 118 | index === posts.length - 1 ? null : posts[index + 1].node 119 | const next = index === 0 ? null : posts[index - 1].node 120 | 121 | createPage({ 122 | path: post.node.fields.slug, 123 | component: blogPostTemplate, 124 | context: { 125 | slug: post.node.fields.slug, 126 | previous, 127 | next, 128 | }, 129 | }) 130 | }) 131 | 132 | // Create paginated index page 133 | createPaginationPages({ 134 | createPage, 135 | edges: posts, 136 | component: indexPage, 137 | limit: 5, 138 | }) 139 | 140 | const tagSet = new Set() 141 | const tagMap = new Map() 142 | const categorySet = new Set() 143 | const categoryMap = new Map() 144 | posts.forEach(edge => { 145 | if (edge.node.frontmatter.tags) { 146 | edge.node.frontmatter.tags.forEach(tag => { 147 | tagSet.add(tag) 148 | 149 | const array = tagMap.has(tag) ? tagMap.get(tag) : [] 150 | array.push(edge) 151 | tagMap.set(tag, array) 152 | }) 153 | } 154 | 155 | if (edge.node.frontmatter.categories) { 156 | edge.node.frontmatter.categories.forEach(category => { 157 | categorySet.add(category) 158 | 159 | const array = categoryMap.has(category) 160 | ? categoryMap.get(category) 161 | : [] 162 | array.push(edge) 163 | categoryMap.set(category, array) 164 | }) 165 | } 166 | }) 167 | 168 | const tagList = Array.from(tagSet) 169 | const categoryList = Array.from(categorySet) 170 | 171 | tagList.forEach(tag => { 172 | // Create paginated tag pages 173 | const tagFormatter = tag => route => 174 | `/tag/${_.kebabCase(tag)}/${route !== 1 ? route : ''}` 175 | createPaginationPages({ 176 | createPage, 177 | edges: tagMap.get(tag), 178 | component: tagPageTemplate, 179 | pathFormatter: tagFormatter(tag), 180 | limit: 5, 181 | context: { 182 | tag, 183 | }, 184 | }) 185 | }) 186 | 187 | categoryList.forEach(category => { 188 | // Create paginated category pages 189 | const categoryFormatter = category => route => 190 | `/${_.kebabCase(category)}/${route !== 1 ? route : ''}` 191 | createPaginationPages({ 192 | createPage, 193 | edges: categoryMap.get(category), 194 | component: categoryPageTemplate, 195 | pathFormatter: categoryFormatter(category), 196 | limit: 5, 197 | context: { 198 | category, 199 | }, 200 | }) 201 | }) 202 | }) 203 | ) 204 | }) 205 | } 206 | -------------------------------------------------------------------------------- /netlify.toml: -------------------------------------------------------------------------------- 1 | [build.environment] 2 | NODE_VERSION = "8" 3 | YARN_VERSION = "1.2.1" 4 | YARN_FLAGS = "--pure-lockfile --verbose" 5 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gatsby-test", 3 | "description": "Gatsby Test", 4 | "version": "2.0.0", 5 | "author": "Michael Rose", 6 | "bugs": { 7 | "url": "https://github.com/mmistakes/gatsby-test/issues" 8 | }, 9 | "dependencies": { 10 | "bluebird": "^3.5.1", 11 | "classnames": "^2.2.6", 12 | "gatsby": "next", 13 | "gatsby-image": "next", 14 | "gatsby-pagination": "^1.2.0", 15 | "gatsby-plugin-feed": "next", 16 | "gatsby-plugin-glamor": "next", 17 | "gatsby-plugin-google-analytics": "next", 18 | "gatsby-plugin-netlify": "next", 19 | "gatsby-plugin-offline": "next", 20 | "gatsby-plugin-react-helmet": "next", 21 | "gatsby-plugin-sharp": "next", 22 | "gatsby-plugin-sitemap": "next", 23 | "gatsby-plugin-twitter": "next", 24 | "gatsby-remark-abbr": "^1.0.0", 25 | "gatsby-remark-autolink-headers": "next", 26 | "gatsby-remark-copy-linked-files": "next", 27 | "gatsby-remark-custom-blocks": "next", 28 | "gatsby-remark-emoji": "^0.0.1", 29 | "gatsby-remark-images": "next", 30 | "gatsby-remark-numbered-footnotes": "^1.0.0", 31 | "gatsby-remark-prismjs": "next", 32 | "gatsby-remark-responsive-iframe": "next", 33 | "gatsby-remark-smartypants": "next", 34 | "gatsby-remark-source-name": "^1.0.0", 35 | "gatsby-source-filesystem": "next", 36 | "gatsby-transformer-remark": "next", 37 | "gatsby-transformer-sharp": "next", 38 | "glamor": "^2.20.40", 39 | "lodash": "^4.17.19", 40 | "moment": "^2.22.2", 41 | "prismjs": "^1.15.0", 42 | "prop-types": "^15.6.2", 43 | "react": "^16.4.1", 44 | "react-dom": "^16.4.1", 45 | "react-gravatar": "^2.6.3", 46 | "react-helmet": "^5.2.0", 47 | "slug": "^0.9.1", 48 | "typeface-alegreya": "^0.0.54" 49 | }, 50 | "devDependencies": { 51 | "eslint": "4.19.1", 52 | "eslint-config-airbnb": "16.1.0", 53 | "eslint-config-prettier": "2.9.0", 54 | "eslint-plugin-import": "2.12.0", 55 | "eslint-plugin-jsx-a11y": "6.0.3", 56 | "eslint-plugin-prettier": "2.6.0", 57 | "eslint-plugin-react": "7.9.1", 58 | "prettier": "^1.11.1" 59 | }, 60 | "homepage": "https://github.com/gatsbyjs/gatsby-starter-blog#readme", 61 | "keywords": [ 62 | "gatsby" 63 | ], 64 | "license": "MIT", 65 | "main": "n/a", 66 | "repository": { 67 | "type": "git", 68 | "url": "git+https://github.com/gatsbyjs/gatsby-starter-blog.git" 69 | }, 70 | "scripts": { 71 | "lint": "./node_modules/.bin/eslint --ext .js,.jsx --ignore-pattern public .", 72 | "test": "echo \"Error: no test specified\" && exit 1", 73 | "format": "prettier --trailing-comma es5 --no-semi --single-quote --write \"src/**/*.js\"", 74 | "develop": "gatsby develop", 75 | "build": "gatsby build" 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/assets/images/1200x500.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmistakes/gatsby-test/5183cb42e5ec017c8bf5ca47830a3d39b5c7c2ba/src/assets/images/1200x500.png -------------------------------------------------------------------------------- /src/assets/images/1200x600.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmistakes/gatsby-test/5183cb42e5ec017c8bf5ca47830a3d39b5c7c2ba/src/assets/images/1200x600.JPG -------------------------------------------------------------------------------- /src/assets/images/600x300.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmistakes/gatsby-test/5183cb42e5ec017c8bf5ca47830a3d39b5c7c2ba/src/assets/images/600x300.jpg -------------------------------------------------------------------------------- /src/assets/images/7758832526_cc8f681e48_c.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmistakes/gatsby-test/5183cb42e5ec017c8bf5ca47830a3d39b5c7c2ba/src/assets/images/7758832526_cc8f681e48_c.jpg -------------------------------------------------------------------------------- /src/assets/images/bio-photo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmistakes/gatsby-test/5183cb42e5ec017c8bf5ca47830a3d39b5c7c2ba/src/assets/images/bio-photo.jpg -------------------------------------------------------------------------------- /src/assets/images/image-alignment-1200x4002.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmistakes/gatsby-test/5183cb42e5ec017c8bf5ca47830a3d39b5c7c2ba/src/assets/images/image-alignment-1200x4002.jpg -------------------------------------------------------------------------------- /src/assets/images/image-alignment-150x150.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmistakes/gatsby-test/5183cb42e5ec017c8bf5ca47830a3d39b5c7c2ba/src/assets/images/image-alignment-150x150.jpg -------------------------------------------------------------------------------- /src/assets/images/image-alignment-300x200.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmistakes/gatsby-test/5183cb42e5ec017c8bf5ca47830a3d39b5c7c2ba/src/assets/images/image-alignment-300x200.jpg -------------------------------------------------------------------------------- /src/assets/images/image-alignment-580x300.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmistakes/gatsby-test/5183cb42e5ec017c8bf5ca47830a3d39b5c7c2ba/src/assets/images/image-alignment-580x300.jpg -------------------------------------------------------------------------------- /src/assets/images/joshua-earle-234740.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmistakes/gatsby-test/5183cb42e5ec017c8bf5ca47830a3d39b5c7c2ba/src/assets/images/joshua-earle-234740.jpg -------------------------------------------------------------------------------- /src/assets/images/null.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmistakes/gatsby-test/5183cb42e5ec017c8bf5ca47830a3d39b5c7c2ba/src/assets/images/null.png -------------------------------------------------------------------------------- /src/assets/images/unsplash-image-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmistakes/gatsby-test/5183cb42e5ec017c8bf5ca47830a3d39b5c7c2ba/src/assets/images/unsplash-image-1.jpg -------------------------------------------------------------------------------- /src/assets/images/unsplash-image-10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmistakes/gatsby-test/5183cb42e5ec017c8bf5ca47830a3d39b5c7c2ba/src/assets/images/unsplash-image-10.jpg -------------------------------------------------------------------------------- /src/assets/images/unsplash-image-11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmistakes/gatsby-test/5183cb42e5ec017c8bf5ca47830a3d39b5c7c2ba/src/assets/images/unsplash-image-11.jpg -------------------------------------------------------------------------------- /src/assets/images/unsplash-image-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmistakes/gatsby-test/5183cb42e5ec017c8bf5ca47830a3d39b5c7c2ba/src/assets/images/unsplash-image-2.jpg -------------------------------------------------------------------------------- /src/assets/images/unsplash-image-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmistakes/gatsby-test/5183cb42e5ec017c8bf5ca47830a3d39b5c7c2ba/src/assets/images/unsplash-image-3.jpg -------------------------------------------------------------------------------- /src/assets/images/unsplash-image-4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmistakes/gatsby-test/5183cb42e5ec017c8bf5ca47830a3d39b5c7c2ba/src/assets/images/unsplash-image-4.jpg -------------------------------------------------------------------------------- /src/assets/images/unsplash-image-5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmistakes/gatsby-test/5183cb42e5ec017c8bf5ca47830a3d39b5c7c2ba/src/assets/images/unsplash-image-5.jpg -------------------------------------------------------------------------------- /src/assets/images/unsplash-image-6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmistakes/gatsby-test/5183cb42e5ec017c8bf5ca47830a3d39b5c7c2ba/src/assets/images/unsplash-image-6.jpg -------------------------------------------------------------------------------- /src/assets/images/unsplash-image-7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmistakes/gatsby-test/5183cb42e5ec017c8bf5ca47830a3d39b5c7c2ba/src/assets/images/unsplash-image-7.jpg -------------------------------------------------------------------------------- /src/assets/images/unsplash-image-8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmistakes/gatsby-test/5183cb42e5ec017c8bf5ca47830a3d39b5c7c2ba/src/assets/images/unsplash-image-8.jpg -------------------------------------------------------------------------------- /src/assets/images/unsplash-image-9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmistakes/gatsby-test/5183cb42e5ec017c8bf5ca47830a3d39b5c7c2ba/src/assets/images/unsplash-image-9.jpg -------------------------------------------------------------------------------- /src/comments/markup/markup-html-tags-and-formatting/comment-1528316381544.md: -------------------------------------------------------------------------------- 1 | --- 2 | _id: f192a200-69c6-11e8-923b-09e0420093dc 3 | _parent: /markup/markup-html-tags-and-formatting/ 4 | name: Tester 5 | email: b642b4217b34b1e8d3bd915fc65c4452 6 | url: '' 7 | date: '2018-06-06T20:19:41.542Z' 8 | timestamp: 1528316381 9 | tags: 10 | - comment-subscription 11 | --- 12 | This is a **test** comment. 13 | -------------------------------------------------------------------------------- /src/comments/markup/markup-syntax-highlighting/comment-1528733989174.md: -------------------------------------------------------------------------------- 1 | --- 2 | _id: 406aa0b0-6d93-11e8-ba6b-61e5423f919c 3 | _parent: /markup/markup-syntax-highlighting/ 4 | name: William Rick 5 | email: 8c0ab0e8950c120f8f398d7047d65fbe 6 | url: 'https://thewhip.com' 7 | date: '2018-06-11T16:19:49.173Z' 8 | tags: 9 | - comment-subscription 10 | --- 11 | This is a message with **Markdown**. 12 | 13 | - Cool list item 14 | - Another list item 15 | -------------------------------------------------------------------------------- /src/comments/markup/markup-text-readability/comment-1535554587673.md: -------------------------------------------------------------------------------- 1 | --- 2 | _id: b4989820-ab9b-11e8-b6e7-61e1106727d7 3 | _parent: /markup/markup-text-readability/ 4 | name: Tester 5 | email: b642b4217b34b1e8d3bd915fc65c4452 6 | url: '' 7 | date: '2018-08-29T14:56:27.672Z' 8 | --- 9 | Testing comments. Is **Markdown** working? 10 | -------------------------------------------------------------------------------- /src/comments/post/hello-world/comment-1470942205700.md: -------------------------------------------------------------------------------- 1 | --- 2 | _id: 21389089-ggg-0129089048123 3 | _parent: /post/hello-world/ 4 | name: Michael Rose 5 | email: 1ce71bc10b86565464b612093d89707e 6 | url: 'https://mademistakes.com' 7 | hidden: '' 8 | date: '2016-08-11T19:03:24.929Z' 9 | --- 10 | 11 | This is a test comment with some **Markdown** sprinkled about for *testing purposes*. 12 | 13 | ### Subheading in a comment? Madness! 14 | 15 | Nam et risus nec ipsum efficitur facilisis. Aenean tincidunt dapibus odio, eget rutrum urna lacinia non. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. 16 | -------------------------------------------------------------------------------- /src/comments/post/hello-world/comment-1470942247755.md: -------------------------------------------------------------------------------- 1 | --- 2 | _id: 2380982-yyy-09342 3 | _parent: /post/hello-world/ 4 | name: Jackalope 5 | email: cba827e665ae179e1d1ae007a6c3c1ab 6 | url: '' 7 | hidden: '' 8 | date: '2016-08-11T19:04:06.958Z' 9 | --- 10 | 11 | How much wood would a woodchuck chuck if a woodchuck could chuck wood? 12 | -------------------------------------------------------------------------------- /src/comments/post/hello-world/comment-1470942265819.md: -------------------------------------------------------------------------------- 1 | --- 2 | _id: 9C8F8CF0139B-eeee-1840C596C18913899B67 3 | _parent: /post/hello-world/ 4 | name: Jackalope Duplicate 5 | email: cba827e665ae179e1d1ae007a6c3c1ab 6 | url: '' 7 | hidden: '' 8 | date: '2016-08-11T19:04:25.085Z' 9 | --- 10 | 11 | How much wood would a woodchuck chuck if a woodchuck could chuck wood? 12 | -------------------------------------------------------------------------------- /src/comments/post/hello-world/comment-1470942493518.md: -------------------------------------------------------------------------------- 1 | --- 2 | _id: D62452A6A2-fffe-A92A491C042057F34CEC4D 3 | _parent: /post/hello-world/ 4 | name: Michael Rose 5 | email: 1ce71bc10b86565464b612093d89707e 6 | url: 'https://mademistakes.com' 7 | hidden: '' 8 | date: '2016-08-11T19:08:12.789Z' 9 | --- 10 | 11 | Images can be added to a comment using Markdown like this 12 | 13 | ```markdown 14 | ![Bill Murray](http://www.fillmurray.com/600/400) 15 | ``` 16 | 17 | ![Bill Murray](http://www.fillmurray.com/600/400) 18 | -------------------------------------------------------------------------------- /src/comments/post/hello-world/comment-1471823346931.md: -------------------------------------------------------------------------------- 1 | --- 2 | _id: 4364EC7E5B1AAF92-abcv-0D1633BD76596353 3 | _parent: /post/hello-world/ 4 | name: kkangshawn 5 | email: db92190b2ee6118786fd1f25dceb448c 6 | url: '' 7 | hidden: '' 8 | date: '2016-08-21T23:49:06.270Z' 9 | --- 10 | 11 | Wow, this is awesome 12 | -------------------------------------------------------------------------------- /src/comments/post/hello-world/comment-1471834988411.md: -------------------------------------------------------------------------------- 1 | --- 2 | _id: BC0ABD33B576-efg-FBC851247CE03D5CFE03 3 | _parent: /post/hello-world/ 4 | name: Test 5 | email: b642b4217b34b1e8d3bd915fc65c4452 6 | url: '' 7 | hidden: '' 8 | date: '2016-08-22T03:03:07.694Z' 9 | --- 10 | 11 | Test 12 | -------------------------------------------------------------------------------- /src/comments/post/hello-world/comment-1472786599470.md: -------------------------------------------------------------------------------- 1 | --- 2 | _id: 4EE3610819D22-rytrtr-E465A8E2E53D64A2FAB 3 | _parent: /post/hello-world/ 4 | name: TestName 5 | email: 97dfebf4098c0f5c16bca61e2b76c373 6 | url: '' 7 | hidden: '' 8 | date: '2016-09-02T03:23:18.756Z' 9 | --- 10 | 11 | This is a test 12 | -------------------------------------------------------------------------------- /src/comments/post/hello-world/comment-1474328950155.md: -------------------------------------------------------------------------------- 1 | --- 2 | _id: 7E86DB11E41E719942C-reqq-48C84EA9BC7C0 3 | _parent: /post/hello-world/ 4 | name: js 5 | email: f349d4bc6fa472971f68bcccc04337f9 6 | url: '' 7 | hidden: '' 8 | date: '2016-09-19T23:49:09.452Z' 9 | --- 10 | 11 | just testing as well 12 | -------------------------------------------------------------------------------- /src/comments/post/hello-world/comment-1500505983331.md: -------------------------------------------------------------------------------- 1 | --- 2 | _id: d073fc00-6cd7-11e7-a639-bb0964fd6b0b 3 | _parent: /post/hello-world/ 4 | name: Bob Whitelock 5 | email: 38d95e43292a76cbefab8f8a823df64f 6 | url: 'http://www.bobwhitelock.co.uk' 7 | hidden: '' 8 | date: '2017-07-19T23:13:03.331Z' 9 | --- 10 | 11 | Another test comment here :) 12 | -------------------------------------------------------------------------------- /src/comments/post/hello-world/comment-1507141538771.md: -------------------------------------------------------------------------------- 1 | --- 2 | uuid: 6b96b520-a931-11e7-9a7d-c99de06bb99b 3 | _parent: /post/hello-world/ 4 | name: Michael Rose 5 | email: 1ce71bc10b86565464b612093d89707e 6 | url: 'https://mademistakes.com' 7 | hidden: '' 8 | date: '2017-10-04T18:25:38.766Z' 9 | --- 10 | 11 | Testing out leaving a comment with the new Staticman v2 endpoint and reCAPTCHA enabled. 12 | -------------------------------------------------------------------------------- /src/comments/post/post-future-date/comment-1527277069391.md: -------------------------------------------------------------------------------- 1 | --- 2 | _id: 1b413350-6053-11e8-bf3d-35969255318e 3 | _parent: /post/post-future-date/ 4 | name: Michael 5 | email: b642b4217b34b1e8d3bd915fc65c4452 6 | url: '' 7 | date: '2018-05-25T19:37:49.391Z' 8 | timestamp: 1527277069 9 | tags: 10 | - comment-subscription 11 | --- 12 | 13 | Test comment. 14 | -------------------------------------------------------------------------------- /src/components/Byline.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import PropTypes from 'prop-types' 3 | import colors from '../utils/colors' 4 | import fonts from '../utils/fonts' 5 | import presets from '../utils/presets' 6 | 7 | class Byline extends React.Component { 8 | render() { 9 | const { author } = this.props 10 | return ( 11 |
19 | {author ? ( 20 | 28 | {author} 29 | 30 | ) : ( 31 | 32 | )} 33 |
34 | ) 35 | } 36 | } 37 | 38 | Byline.propTypes = { 39 | author: PropTypes.string.isRequired, 40 | } 41 | 42 | export default Byline 43 | -------------------------------------------------------------------------------- /src/components/Comment.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { graphql } from 'gatsby' 3 | import PropTypes from 'prop-types' 4 | import Gravatar from 'react-gravatar' 5 | 6 | const Comment = props => { 7 | const { name, url, email, friendlyDate, iso8601Date, children } = props 8 | 9 | return ( 10 |
16 |
22 | 23 |
24 |
25 |
30 | {url !== '' ? ( 31 | 32 | {name} 33 | 34 | ) : ( 35 | {name} 36 | )} 37 |  on 38 |
39 | {children} 40 |
41 |
42 | ) 43 | } 44 | 45 | Comment.propTypes = { 46 | name: PropTypes.string.isRequired, 47 | url: PropTypes.string.isRequired, 48 | email: PropTypes.string.isRequired, 49 | friendlyDate: PropTypes.string.isRequired, 50 | iso8601Date: PropTypes.string.isRequired, 51 | children: PropTypes.oneOfType([ 52 | PropTypes.arrayOf(PropTypes.node), 53 | PropTypes.node, 54 | ]).isRequired, 55 | } 56 | 57 | export default Comment 58 | 59 | export const commentQuery = graphql` 60 | fragment commentAttributesFragment on MarkdownRemark { 61 | frontmatter { 62 | name 63 | url 64 | email 65 | uuid: date 66 | friendlyDate: date(formatString: "MMMM DD, YYYY") 67 | iso8601Date: date 68 | } 69 | html 70 | } 71 | ` 72 | -------------------------------------------------------------------------------- /src/components/Comments.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { graphql } from 'gatsby' 3 | import Comment from './Comment' 4 | 5 | const Comments = data => { 6 | if (data.comments === null) { 7 | return null 8 | } 9 | const { 10 | comments: { edges: comments }, 11 | } = data 12 | 13 | const commentList = comments.map(({ node }) => { 14 | const { 15 | frontmatter: { name, url, email, uuid, friendlyDate, iso8601Date }, 16 | html, 17 | } = node 18 | 19 | return ( 20 | 28 |
29 | 30 | ) 31 | }) 32 | return ( 33 |
34 |

Comments

35 | {commentList} 36 |
37 | ) 38 | } 39 | 40 | export default Comments 41 | 42 | export const CommentsBySlug = graphql` 43 | fragment commentsQueryFragment on Query { 44 | comments: allMarkdownRemark( 45 | filter: { 46 | fields: { sourceName: { eq: "comments" } } 47 | frontmatter: { _parent: { eq: $slug } } 48 | } 49 | sort: { fields: [fields___slug, frontmatter___date], order: ASC } 50 | ) { 51 | edges { 52 | node { 53 | ...commentAttributesFragment 54 | } 55 | } 56 | } 57 | } 58 | ` 59 | -------------------------------------------------------------------------------- /src/components/CommentsForm.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import PropTypes from 'prop-types' 3 | import config from '../../config/SiteConfig' 4 | import presets from '../utils/presets' 5 | import fonts from '../utils/fonts' 6 | 7 | class CommentForm extends React.Component { 8 | render() { 9 | const slugDir = this.props.slug.replace(/^\/+|/g, ``) 10 | const formUrl = `https://api.staticman.net/v2/entry/mmistakes/gatsby-test/master/comments` 11 | const successPage = `${config.siteUrl}/comment-success` 12 | 13 | return ( 14 |
15 |

Leave a Comment

16 |
24 | 25 | 26 | 27 |
37 | 70 | 103 | 135 |
136 |
137 |