Skip to content

Commit

Permalink
Docs: expand deploy recipe (gatsbyjs#15605)
Browse files Browse the repository at this point in the history
*  initial commit expanding deploy recipe

* finished expanding deploy recipe

* chore: format

* Shorten prerequisites in docs/docs/recipes.md

Co-Authored-By: Marcy Sutton <marcy@gatsbyjs.com>

* Clean up path prefix steps docs/docs/recipes.md

Co-Authored-By: Marcy Sutton <marcy@gatsbyjs.com>

* Clean up step #3 in docs/docs/recipes.md

Co-Authored-By: Marcy Sutton <marcy@gatsbyjs.com>

* Clean up #4 in docs/docs/recipes.md

Co-Authored-By: Marcy Sutton <marcy@gatsbyjs.com>

* Clean up #5 in docs/docs/recipes.md

Co-Authored-By: Marcy Sutton <marcy@gatsbyjs.com>

* Shorten build/serve command in deploy recipe docs/docs/recipes.md

Co-Authored-By: Marcy Sutton <marcy@gatsbyjs.com>

* Update docs/docs/recipes.md

Co-Authored-By: Marcy Sutton <marcy@gatsbyjs.com>

* Shorten path prefix deploy recipe section docs/docs/recipes.md

Co-Authored-By: Marcy Sutton <marcy@gatsbyjs.com>

* Remove actual deployment from deploy recipe docs/docs/recipes.md

Co-Authored-By: Marcy Sutton <marcy@gatsbyjs.com>

* Clean up prefix-paths section deploy recipe docs/docs/recipes.md

Co-Authored-By: Marcy Sutton <marcy@gatsbyjs.com>

* Update deploy recipe formatting

Co-Authored-By: Marcy Sutton <marcy@gatsbyjs.com>

* Update formatting on deploy recipe CLI bullet point

Co-Authored-By: Marcy Sutton <marcy@gatsbyjs.com>

* Added deploy recipe header

Co-Authored-By: Marcy Sutton <marcy@gatsbyjs.com>

* chore: format
  • Loading branch information
tom-raley authored and GatsbyJS Bot committed Jul 20, 2019
1 parent 4597116 commit 96aa890
Showing 1 changed file with 44 additions and 3 deletions.
47 changes: 44 additions & 3 deletions docs/docs/recipes.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,53 @@ To wrap pages with layouts, use normal React components.

## Deploying

Showtime.
Showtime. Once you are happy with your site, you are ready to go live with it!

### Preparing for deployment

#### Prerequisites

- A [Gatsby site](/docs/quick-start)
- The [Gatsby CLI](/docs/gatsby-cli) installed

#### Directions

1. Stop your development server if it is running (`Ctrl + C` on your command line in most cases)

2. For the standard site path at the root directory (`/`), run `gatsby build` using the Gatsby CLI on the command line. The built files will now be in the `public` folder.

```shell
gatsby build
```

3. To include a site path other than `/` (such as `/site-name/`), set a path prefix by adding the following to your `gatsby-config.js` and replacing `yourpathprefix` with your desired path prefix:

```js:title=gatsby-config.js
module.exports = {
pathPrefix: `/yourpathprefix`,
}
```

There are a few reasons to do this--for instance, hosting a blog built with Gatsby on a domain with another site not built on Gatsby. The main site would direct to `example.com`, and the Gatsby site with a path prefix could live at `example.com/blog`.

4. With a path prefix set in `gatsby-config.js`, run `gatsby build` with the `--prefix-paths` flag to automatically add the prefix to the beginning of all Gatsby site URLs and `<Link>` tags.

```shell
gatsby build --prefix-paths
```

5. Make sure that your site looks the same when running `gatsby build` as with `gatsby develop`. By running `gatsby serve` when you build your site, you can test out (and debug if necessary) the finished product before deploying it live.

```shell
gatsby build && gatsby serve
```

#### Additional Resources

- Walk through building and deploying an example site in [tutorial part one](/tutorial/part-one/#deploying-a-gatsby-site)
- Learn how to make sure your site is configured properly to be [searchable, shareable, and properly navigable](/docs/preparing-for-site-launch/)
- Learn about [performance optimization](/docs/performance/)
- Read about [other deployment related topics](/docs/deploying-and-hosting/)
- Read about [other deployment related topics](/docs/preparing-for-deployment/)
- Check out the [deployment docs](/docs/deploying-and-hosting/) for specific hosting platforms and how to deploy to them

## Querying data

Expand Down

0 comments on commit 96aa890

Please sign in to comment.