Skip to content

Commit

Permalink
Create deploying-to-netlify.md (#8406)
Browse files Browse the repository at this point in the history
Issue #8103: this is for the "Deploy using Netlify". I tried to write a short beginner-friendly easy to follow guide for using Gatsby with Netlify.

The "Getting Started - Netlify" is copy-and-pasted of the "Deploy to S3" site, 
the introduction from the original "Deploy and Build" page.

I don't see any need for an additional "Hosting on Netlify" article.

<!--
  Q. Which branch should I use for my pull request?
  A. Use `master` branch (probably).

  Q. Which branch if my change is a bug fix for Gatsby v1?
  A. In this case, you should use the `v1` branch

  Q. Which branch if I'm still not sure?
  A. Use `master` branch. Ask in the PR if you're not sure and a Gatsby maintainer will be happy to help :)

  Note: We will only accept bug fixes for Gatsby v1. New features should be added to Gatsby v2.

  Learn more about contributing: https://www.gatsbyjs.org/docs/how-to-contribute/
-->
  • Loading branch information
jonathanvoelkle authored and calcsam committed Sep 23, 2018
1 parent d1906e3 commit d3874e3
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions docs/docs/deploying-to-netlify.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
title: Deploying to Netlify
---

In this guide, we'll walk through how to host & publish your next Gatsby site to [Netlify](https://www.netlify.com/).

Netlify is an excellent option for deploying Gatsby sites. Netlify is a unified
platform that automates your code to create high-performant, easily maintainable
sites and web apps. They provide continuous deployment (Git-triggered builds),
an intelligent, global CDN, full DNS (including custom domains), automated
HTTPS, asset acceleration, and a lot more.

Their free tier includes unlimited personal and commercial projects, HTTPS,
continuous deployment from public or private repos and more.

## Getting Started - Gatsby

First, we'll want to create a new Gatsby project. If you don't already have Gatsby installed, install it:

```sh
npm install --global gatsby-cli
```

Next, we'll create a new Gatsby site:

```sh
gatsby new my-gatsby-site
```

Finally, change into the new site directory:

```sh
cd my-gatsby-site
```

**NOTE**: There is no need to build the site, Netlify can handle that for us.

## Getting Started - Netlify

Now, that the Gatsby site is running, we need to upload your Gatsby site to [Github](https://github.com/), [Gitlab](https://about.gitlab.com/) or [Bitbucket](https://bitbucket.org/).

Now, go to Netlify and signup if you haven't already.
We connect to Github (or Gitlab/Bitbucket) and select the repository.

We can change how Netlify builds and deploys the site.
If we change nothing, Netlify will build the `master` branch of the repository and will invoke the `gatsby build` command after we clicked deploy.
If you would have previously build the site and pushed the build to Git, Netlify would publish the directory selected (`/public`).

After Netlify now finished the build, we can see the website on the given url.

## Continuous Deployment

Now that your site is connected to your repository, Netlify will deploy the site and publish it whenever you push to your Git repo.

## References

- [Introduction to Gatsby](https://www.gatsbyjs.org/blog/2017-05-31-introduction-to-gatsby/#deployment)
- [Escalade Sports: From $5000 to $5/month in Hosting With Gatsby](https://www.gatsbyjs.org/blog/2018-06-14-escalade-sports-from-5000-to-5-in-hosting/)
- [Why I created my blog with Gatsby and Contentful](https://www.gatsbyjs.org/blog/2017-11-09-why-i-created-my-blog-with-gatsby-and-contentful/#hosting-with-netlify)
- [Gatsby + Contentful + Netlify (and Algolia)](https://www.gatsbyjs.org/blog/2017-12-06-gatsby-plus-contentful-plus-netlify/#solution-netlify--gatsby)

0 comments on commit d3874e3

Please sign in to comment.