Skip to content

Instantly share code, notes, and snippets.

@jhcao23
Last active July 7, 2020 02:47
Show Gist options
  • Save jhcao23/5cb42ef2b053db0f8446ced1d99bd6bc to your computer and use it in GitHub Desktop.
Save jhcao23/5cb42ef2b053db0f8446ced1d99bd6bc to your computer and use it in GitHub Desktop.
how to setup Gatsby blog quickly

How to setup Gatsby blog

  1. target: src code maintained in master branch and the generated blog content stays in gh-pages branch.

  2. global config: $HOME/.config/gatsby/config.json:

    • add this if you prefer yarn|npm:
      "cli": {
              "packageManager": "yarn"
      } 
      
  3. gatsby-config.js:

    • add pathPrefix: "/", to the top within module.exports.
    • update everything of siteMetadata.
    • update trackingId for gatsby-plugin-google-analytics.
    • add gatsby-plugin-facebook-analytics if needed.
    • add gatsby-plugin-baidu-tongji if needed.
    • update gatsby-plugin-manifest for names and icon and more needed.
  4. packages.json:

    • add gh-pages to devDependencies.
    • update dependencies version.
    • add a self-defined deploy to scripts such as "deploy": "gitgit \"update\" && gatsby build --prefix-paths && gh-pages -d public".
  5. content:

    • update content/assets/logo.png.
    • update content/assets/logo_transparent.png.
    • update content/assets/profile-pic.png.
    • the most important: add your blogging content to content/blog/.
  6. static:

    • add CNAME: add the subdomain as the content.
    • update favicon.ico.
  7. update src/ wherever possible such as index, bio, layout, blog-post files.

  8. generated folders:

    • public/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment