├── .prettierrc ├── src ├── images │ ├── icon.png │ ├── jane.jpg │ ├── john.jpg │ └── javascript.jpg ├── styles │ ├── _card.scss │ ├── _variables.scss │ ├── index.scss │ ├── _links.scss │ ├── _sidebar.scss │ ├── _base.scss │ └── _footer.scss ├── pages │ ├── posts │ │ ├── 004-fourth-post.md │ │ ├── 005-fifth-post.md │ │ ├── 001-first-post.md │ │ ├── 002-second-post.md │ │ └── 003-third-post.md │ ├── 404.js │ ├── about.js │ ├── team.js │ └── index.js ├── util │ ├── utilityFunctions.js │ └── authors.js ├── templates │ ├── tags-page.js │ ├── tag-posts.js │ ├── post-list.js │ ├── author-posts.js │ └── single-post.js └── components │ ├── Post.js │ ├── layout.js │ ├── header.js │ ├── PaginationLinks.js │ ├── Footer.js │ ├── seo.js │ └── Sidebar.js ├── gatsby-browser.js ├── gatsby-ssr.js ├── .travis.yml ├── LICENSE ├── README.md ├── .gitignore ├── gatsby-config.js ├── package.json └── gatsby-node.js /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "singleQuote": true, 4 | "trailingComma": "es5" 5 | } 6 | -------------------------------------------------------------------------------- /src/images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hidjou/classsed-gatsby-blog/HEAD/src/images/icon.png -------------------------------------------------------------------------------- /src/images/jane.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hidjou/classsed-gatsby-blog/HEAD/src/images/jane.jpg -------------------------------------------------------------------------------- /src/images/john.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hidjou/classsed-gatsby-blog/HEAD/src/images/john.jpg -------------------------------------------------------------------------------- /src/images/javascript.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hidjou/classsed-gatsby-blog/HEAD/src/images/javascript.jpg -------------------------------------------------------------------------------- /gatsby-browser.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Implement Gatsby's Browser APIs in this file. 3 | * 4 | * See: https://www.gatsbyjs.org/docs/browser-apis/ 5 | */ 6 | 7 | // You can delete this file if you're not using it 8 | -------------------------------------------------------------------------------- /gatsby-ssr.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Implement Gatsby's SSR (Server Side Rendering) APIs in this file. 3 | * 4 | * See: https://www.gatsbyjs.org/docs/ssr-apis/ 5 | */ 6 | 7 | // You can delete this file if you're not using it 8 | -------------------------------------------------------------------------------- /src/styles/_card.scss: -------------------------------------------------------------------------------- 1 | .card { 2 | margin-bottom: 30px; 3 | } 4 | ul.post-tags { 5 | padding: 0; 6 | display: inline-flex; 7 | list-style: none; 8 | 9 | li { 10 | margin-right: 10px; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/styles/_variables.scss: -------------------------------------------------------------------------------- 1 | @import url('https://fonts.googleapis.com/css?family=Raleway'); 2 | 3 | $site-font: 'Raleway', sans-serif; 4 | 5 | $light-gray: rgb(240, 240, 240); 6 | $dark-gray: rgb(80, 80, 80); 7 | $white: white; 8 | -------------------------------------------------------------------------------- /src/pages/posts/004-fourth-post.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Fourth Post - CSS' 3 | date: 2018-12-04 07:00:00 4 | author: 'Jane Doe' 5 | image: ../../images/javascript.jpg 6 | tags: 7 | - tutorial 8 | --- 9 | 10 | New post on Netlify 11 | -------------------------------------------------------------------------------- /src/pages/posts/005-fifth-post.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Fifth Post - CSS' 3 | date: 2018-12-05 07:00:00 4 | author: 'John Doe' 5 | image: ../../images/javascript.jpg 6 | tags: 7 | - tutorial 8 | --- 9 | 10 | New post on TravisCI 11 | -------------------------------------------------------------------------------- /src/styles/index.scss: -------------------------------------------------------------------------------- 1 | // Bootstrap scss 2 | @import '../../node_modules/bootstrap/scss/bootstrap.scss'; 3 | 4 | @import './variables'; 5 | @import './base'; 6 | @import './footer'; 7 | @import './card'; 8 | @import './links'; 9 | @import './sidebar'; 10 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 8.14.0 4 | install: yarn 5 | script: gatsby build 6 | deploy: 7 | provider: s3 8 | access_key_id: $AWS_KEY 9 | secret_access_key: $AWS_SECRET 10 | bucket: 'gatsby-test-deploy' 11 | skip_cleanup: true 12 | acl: public_read 13 | local_dir: public 14 | -------------------------------------------------------------------------------- /src/pages/404.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { Link } from 'gatsby' 3 | import Layout from '../components/layout' 4 | import SEO from '../components/seo' 5 | 6 | const NotFoundPage = () => ( 7 | 8 | 9 | 10 | Go home 11 | 12 | 13 | ) 14 | 15 | export default NotFoundPage 16 | -------------------------------------------------------------------------------- /src/pages/posts/001-first-post.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'First Post - Introduction' 3 | date: 2018-12-01 07:00:00 4 | author: 'John Doe' 5 | image: ../../images/javascript.jpg 6 | tags: 7 | - code 8 | --- 9 | 10 | Welcome to Code Blog, I hope you enjoy the content, Welcome to Code Blog, I hope you enjoy the content, Welcome to Code Blog, I hope you enjoy the content, Welcome to Code Blog, I hope you enjoy the content, Welcome to Code Blog, I hope you enjoy the content. 11 | -------------------------------------------------------------------------------- /src/pages/posts/002-second-post.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Second Post - HTML' 3 | date: 2018-12-02 07:00:00 4 | author: 'Jane Doe' 5 | image: ../../images/javascript.jpg 6 | tags: 7 | - code 8 | - design 9 | --- 10 | 11 | Today, we are gonna learn about HTML5, Today, we are gonna learn about HTML5, Today, we are gonna learn about HTML5, Today, we are gonna learn about HTML5, Today, we are gonna learn about HTML5, Today, we are gonna learn about HTML5, Today, we are gonna learn about HTML5. 12 | -------------------------------------------------------------------------------- /src/util/utilityFunctions.js: -------------------------------------------------------------------------------- 1 | const slugify = function(text) { 2 | return text 3 | .toString() 4 | .toLowerCase() 5 | .replace(/\s+/g, '-') // Replace spaces with - 6 | .replace(/[^\w-]+/g, '') // Remove all non-word chars 7 | .replace(/--+/g, '-') // Replace multiple - with single - 8 | .replace(/^-+/, '') // Trim - from start of text 9 | .replace(/-+$/, '') // Trim - from end of text 10 | } 11 | 12 | // Web Design => web-design 13 | 14 | module.exports = { slugify } 15 | -------------------------------------------------------------------------------- /src/styles/_links.scss: -------------------------------------------------------------------------------- 1 | .social-share-links { 2 | ul { 3 | display: inline-flex; 4 | margin: 20px auto; 5 | 6 | li { 7 | margin: auto 20px; 8 | 9 | a { 10 | opacity: 0.6; 11 | transition: all 0.1s ease-in; 12 | &:hover { 13 | opacity: 1; 14 | } 15 | &.facebook { 16 | color: rgb(66, 103, 178); 17 | } 18 | &.twitter { 19 | color: rgb(56, 161, 243); 20 | } 21 | &.google { 22 | color: rgb(221, 75, 57); 23 | } 24 | &.linkedin { 25 | color: rgb(0, 119, 181); 26 | } 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/styles/_sidebar.scss: -------------------------------------------------------------------------------- 1 | .author-social-links { 2 | ul { 3 | display: inline-flex; 4 | 5 | li { 6 | margin: auto 7px; 7 | 8 | a { 9 | transition: all 0.1s ease-out; 10 | color: $dark-gray; 11 | 12 | &.instagram:hover { 13 | color: #e95950; 14 | } 15 | &.facebook:hover { 16 | color: rgb(66, 103, 178); 17 | } 18 | &.twitter:hover { 19 | color: rgb(56, 161, 243); 20 | } 21 | &.google:hover { 22 | color: rgb(221, 75, 57); 23 | } 24 | &.linkedin:hover { 25 | color: rgb(0, 119, 181); 26 | } 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/pages/about.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import Layout from '../components/layout' 3 | import SEO from '../components/seo' 4 | 5 | const AboutPage = () => ( 6 | 7 | 8 |

9 | Lorem ipsum dolor sit amet consectetur adipisicing elit. Minus quibusdam 10 | pariatur magnam nulla quis nobis rerum vitae in delectus modi 11 | exercitationem amet quasi, distinctio illo blanditiis, adipisci, odio unde 12 | minima numquam architecto! Odit sequi facere sit odio maiores possimus 13 | ratione! 14 |

15 |
16 | ) 17 | 18 | export default AboutPage 19 | -------------------------------------------------------------------------------- /src/styles/_base.scss: -------------------------------------------------------------------------------- 1 | .container#content { 2 | margin-top: 60px; 3 | } 4 | body { 5 | background-color: $light-gray; 6 | font-family: $site-font; 7 | } 8 | a { 9 | color: #0056b3; 10 | &:hover { 11 | color: #007bff; 12 | text-decoration: none; 13 | } 14 | } 15 | h1 { 16 | margin-bottom: 20px; 17 | text-align: center; 18 | } 19 | .navbar { 20 | background-color: white; 21 | // border-right: 1px solid rgba(0, 0, 0, 0.4); 22 | // border-left: 1px solid rgba(0, 0, 0, 0.4); 23 | border-bottom: 1px solid rgba(0, 0, 0, 0.4); 24 | line-height: 1; 25 | } 26 | .navbar-light .navbar-nav .nav-link, 27 | .navbar-light .navbar-brand { 28 | color: #0056b3; 29 | &:hover { 30 | color: #007bff; 31 | } 32 | } 33 | ul { 34 | list-style: none; 35 | padding: 0; 36 | } 37 | -------------------------------------------------------------------------------- /src/templates/tags-page.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import Layout from '../components/layout' 3 | import SEO from '../components/seo' 4 | import { Badge, Button } from 'reactstrap' 5 | import { slugify } from '../util/utilityFunctions' 6 | 7 | const tagsPage = ({ pageContext }) => { 8 | const { tags, tagPostCounts } = pageContext 9 | return ( 10 | 11 | 12 | 21 | 22 | ) 23 | } 24 | 25 | export default tagsPage 26 | -------------------------------------------------------------------------------- /src/styles/_footer.scss: -------------------------------------------------------------------------------- 1 | .site-footer { 2 | background-color: $white; 3 | margin-top: 20px; 4 | padding: 10px; 5 | text-align: center; 6 | 7 | .footer-social-links { 8 | text-align: center; 9 | 10 | ul.social-links-list { 11 | li { 12 | margin-right: 25px; 13 | display: inline-block; 14 | 15 | a { 16 | color: $dark-gray; 17 | 18 | &.instagram:hover { 19 | color: #e95950; 20 | } 21 | &.facebook:hover { 22 | color: rgb(66, 103, 178); 23 | } 24 | &.twitter:hover { 25 | color: rgb(56, 161, 243); 26 | } 27 | &.google:hover { 28 | color: rgb(221, 75, 57); 29 | } 30 | &.linkedin:hover { 31 | color: rgb(0, 119, 181); 32 | } 33 | } 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/util/authors.js: -------------------------------------------------------------------------------- 1 | const authors = [ 2 | { 3 | name: 'John Doe', 4 | imageUrl: 'john.jpg', 5 | bio: 6 | 'John has been a front-end and UI designer fpr over 10 years, he is a brilliant artist', 7 | facebook: 'https://www.facebook.com/', 8 | twitter: 'https://www.twitter.com/', 9 | instagram: 'https://www.instagram.com/', 10 | google: 'https://www.google.com/', 11 | linkedin: 'https://www.linkedin.com/', 12 | }, 13 | { 14 | name: 'Jane Doe', 15 | imageUrl: 'jane.jpg', 16 | bio: 17 | 'Jane is a back-end developer, she specializes in security and her favourite stack is the MERN stack', 18 | facebook: 'https://www.facebook.com/', 19 | twitter: 'https://www.twitter.com/', 20 | instagram: 'https://www.instagram.com/', 21 | google: 'https://www.google.com/', 22 | linkedin: 'https://www.linkedin.com/', 23 | }, 24 | ] 25 | 26 | module.exports = authors 27 | -------------------------------------------------------------------------------- /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 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 |

3 | 4 | Gatsby 5 | 6 |

7 |

8 | Gatsby Blog Tutorial 9 |

10 | 11 | This is the complete code for the Gatsby tutorial I published on my Youtube channel 12 | [Classsed](https://www.youtube.com/channel/UC2-slOJImuSc20Drbf88qvg) 13 | 14 | Full tutorial series: https://www.youtube.com/watch?v=lvq2nc3WkZU&list=PLMhAeHCz8S3_x-jXerCYnl7jftCSxQkPV 15 | 16 | ## Guide 17 | 18 | 1. **Clone/Download the code from this repo** 19 | 20 | ```sh 21 | git clone git@github.com:hidjou/gatsby-blog-tutorial.git 22 | ``` 23 | 24 | 1. **Install dependencies** 25 | 26 | ```sh 27 | cd gatsby-blog-tutorial 28 | npm install 29 | ``` 30 | 31 | or 32 | 33 | ```sh 34 | cd gatsby-blog-tutorial 35 | yarn install 36 | ``` 37 | 38 | 1. ** 🚀 Launch project** 39 | 40 | ```sh 41 | gatsby develop 42 | ``` 43 | 44 | The blog is now running at `http://localhost:8000`! 45 | 46 | ## Deployed instance 47 | 48 | https://cocky-elion-477c3b.netlify.com/ 49 | 50 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (http://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # Typescript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # dotenv environment variables file 55 | .env 56 | 57 | # gatsby files 58 | .cache/ 59 | public 60 | 61 | # Mac files 62 | .DS_Store 63 | 64 | # Yarn 65 | yarn-error.log 66 | .pnp/ 67 | .pnp.js 68 | # Yarn Integrity file 69 | .yarn-integrity 70 | -------------------------------------------------------------------------------- /src/components/Post.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { 3 | Badge, 4 | Card, 5 | CardTitle, 6 | CardText, 7 | CardSubtitle, 8 | CardBody, 9 | } from 'reactstrap' 10 | import { Link } from 'gatsby' 11 | import Img from 'gatsby-image' 12 | import { slugify } from '../util/utilityFunctions' 13 | 14 | const Post = ({ title, author, slug, date, body, fluid, tags }) => ( 15 | 16 | 17 | 18 | 19 | 20 | 21 | {title} 22 | 23 | 24 | {date} by{' '} 25 | {author} 26 | 27 | {body} 28 | 39 | 43 | Read more 44 | 45 | 46 | 47 | ) 48 | 49 | export default Post 50 | -------------------------------------------------------------------------------- /gatsby-config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | siteMetadata: { 3 | title: `Code Blog`, 4 | description: `Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need.`, 5 | author: `@gatsbyjs`, 6 | }, 7 | plugins: [ 8 | `gatsby-plugin-react-helmet`, 9 | 'gatsby-plugin-sass', 10 | 'gatsby-plugin-catch-links', 11 | 'gatsby-transformer-remark', 12 | { 13 | resolve: `gatsby-source-filesystem`, 14 | options: { 15 | name: `images`, 16 | path: `${__dirname}/src/images`, 17 | }, 18 | }, 19 | { 20 | resolve: `gatsby-source-filesystem`, 21 | options: { 22 | name: `pages`, 23 | path: `${__dirname}/src/pages`, 24 | }, 25 | }, 26 | `gatsby-transformer-sharp`, 27 | `gatsby-plugin-sharp`, 28 | { 29 | resolve: `gatsby-plugin-manifest`, 30 | options: { 31 | name: `gatsby-starter-default`, 32 | short_name: `starter`, 33 | start_url: `/`, 34 | background_color: `#663399`, 35 | theme_color: `#663399`, 36 | display: `minimal-ui`, 37 | icon: `src/images/icon.png`, // This path is relative to the root of the site. 38 | }, 39 | }, 40 | // this (optional) plugin enables Progressive Web App + Offline functionality 41 | // To learn more, visit: https://gatsby.app/offline 42 | // 'gatsby-plugin-offline', 43 | ], 44 | } 45 | -------------------------------------------------------------------------------- /src/components/layout.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import PropTypes from 'prop-types' 3 | import { StaticQuery, graphql } from 'gatsby' 4 | 5 | import Header from './header' 6 | import Footer from './Footer' 7 | import Sidebar from './Sidebar' 8 | import '../styles/index.scss' 9 | 10 | import { Row, Col } from 'reactstrap' 11 | 12 | const Layout = ({ authorImageFluid, children, pageTitle, postAuthor }) => ( 13 | ( 24 | <> 25 | 31 |
32 |
33 |

{pageTitle}

34 | 35 | {children} 36 | 37 | 38 | 39 | 40 |
41 |