-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework Netlify hosting instructions and examples
Closes #1680
- Loading branch information
Showing
26 changed files
with
129 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
145 changes: 0 additions & 145 deletions
145
content/en/hosting-and-deployment/hosting-on-netlify.md
This file was deleted.
Oops, something went wrong.
127 changes: 127 additions & 0 deletions
127
content/en/hosting-and-deployment/hosting-on-netlify/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
--- | ||
title: Host on Netlify | ||
description: Host your site on Netlify with continuous deployment. | ||
categories: [hosting and deployment] | ||
keywords: [hosting] | ||
menu: | ||
docs: | ||
parent: hosting-and-deployment | ||
toc: true | ||
--- | ||
|
||
## Prerequisites | ||
|
||
1. [Create a Netlify account] | ||
2. [Install Git] | ||
3. [Create a Hugo site] and test it locally with `hugo server` | ||
4. Commit the changes to your local repository | ||
4. Push the local repository to your [GitHub], [GitLab], or [Bitbucket] account | ||
|
||
[Bitbucket]: https://bitbucket.org/product | ||
[Create a Hugo site]: /getting-started/quick-start/ | ||
[Create a Netlify account]: https://app.netlify.com/signup | ||
[GitHub]: https://github.com | ||
[GitLab]: https://about.gitlab.com/ | ||
[Install Git]: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git | ||
|
||
## Procedure | ||
|
||
This procedure will enable continuous deployment from a GitHub repository. The procedure is essentially the same if you are using GitLab or Bitbucket. | ||
|
||
Step 1 | ||
: Log in to your Netlify account, navigate to the Sites page, press the **Add new site** button, and choose "Import an existing project" from the dropdown menu. | ||
|
||
Step 2 | ||
: Select your deployment method. | ||
|
||
![screen capture](netlify-step-02.png) | ||
|
||
Step 3 | ||
: Authorize Netlify to connect with your GitHub account by pressing the **Authorize Netlify** button. | ||
|
||
![screen capture](netlify-step-03.png) | ||
|
||
Step 4 | ||
: Press the **Configure Netlify on GitHub** button. | ||
|
||
![screen capture](netlify-step-04.png) | ||
|
||
Step 5 | ||
: Install the Netlify app by selecting your GitHub account. | ||
|
||
![screen capture](netlify-step-05.png) | ||
|
||
Step 6 | ||
: Press the **Install** button. | ||
|
||
![screen capture](netlify-step-06.png) | ||
|
||
Step 7 | ||
: Click on the site's repository from the list. | ||
|
||
![screen capture](netlify-step-07.png) | ||
|
||
Step 8 | ||
: Set the site name and branch from which to deploy. | ||
|
||
![screen capture](netlify-step-08.png) | ||
|
||
Step 9 | ||
: Define the build settings, press the **Add environment variables** button, then press the **New variable** button. | ||
|
||
![screen capture](netlify-step-09.png) | ||
|
||
Step 10 | ||
: Create a new environment variable named `HUGO_VERSION` and set the value to the [latest version]. | ||
|
||
[latest version]: https://github.com/gohugoio/hugo/releases/latest | ||
|
||
![screen capture](netlify-step-10.png) | ||
|
||
Step 11 | ||
: Press the "Deploy my new site" button at the bottom of the page. | ||
|
||
![screen capture](netlify-step-11.png) | ||
|
||
Step 12 | ||
: At the bottom of the screen, wait for the deploy to complete, then click on the deploy log entry. | ||
|
||
![screen capture](netlify-step-12.png) | ||
|
||
Step 13 | ||
: Press the **Open production deploy** button to view the live site. | ||
|
||
![screen capture](netlify-step-13.png) | ||
|
||
## Configuration file | ||
|
||
In the procedure above we configured our site using the Netlify user interface. Most site owners find it easier to use a configuration file checked into source control. | ||
|
||
Create a new file named netlify.toml in the root of your project directory. In its simplest form, the configuration file might look like this: | ||
|
||
{{< code file=netlify.toml >}} | ||
HUGO_VERSION = "0.122.0" | ||
TZ = "America/Los_Angeles" | ||
|
||
[build] | ||
publish = "public" | ||
command = "hugo --gc --minify" | ||
{{< /code >}} | ||
|
||
If your site requires Dart Sass to transpile Sass to CSS, the configuration file should look something like this: | ||
|
||
{{< code file=netlify.toml >}} | ||
HUGO_VERSION = "0.122.0" | ||
DART_SASS_VERSION = "1.70.0" | ||
TZ = "America/Los_Angeles" | ||
|
||
[build] | ||
publish = "public" | ||
command = """\ | ||
curl -LJO https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz && \ | ||
tar -xf dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz && \ | ||
rm dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz && \ | ||
export PATH=/opt/build/repo/dart-sass:$PATH && \ | ||
hugo --gc --minify \ | ||
""" | ||
{{< /code >}} |
Binary file added
BIN
+8.42 KB
content/en/hosting-and-deployment/hosting-on-netlify/netlify-step-02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+15.6 KB
content/en/hosting-and-deployment/hosting-on-netlify/netlify-step-03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.3 KB
content/en/hosting-and-deployment/hosting-on-netlify/netlify-step-04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.98 KB
content/en/hosting-and-deployment/hosting-on-netlify/netlify-step-05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+23.7 KB
content/en/hosting-and-deployment/hosting-on-netlify/netlify-step-06.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.88 KB
content/en/hosting-and-deployment/hosting-on-netlify/netlify-step-07.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.34 KB
content/en/hosting-and-deployment/hosting-on-netlify/netlify-step-08.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.5 KB
content/en/hosting-and-deployment/hosting-on-netlify/netlify-step-09.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.03 KB
content/en/hosting-and-deployment/hosting-on-netlify/netlify-step-10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.28 KB
content/en/hosting-and-deployment/hosting-on-netlify/netlify-step-11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.66 KB
content/en/hosting-and-deployment/hosting-on-netlify/netlify-step-12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.2 KB
content/en/hosting-and-deployment/hosting-on-netlify/netlify-step-13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-25 KB
static/images/hosting-and-deployment/hosting-on-netlify/netlify-add-new-site.jpg
Binary file not shown.
Binary file removed
BIN
-45.6 KB
...sting-and-deployment/hosting-on-netlify/netlify-authorize-added-permissions.jpg
Binary file not shown.
Binary file removed
BIN
-37 KB
...es/hosting-and-deployment/hosting-on-netlify/netlify-create-new-site-step-1.jpg
Binary file not shown.
Binary file removed
BIN
-41.2 KB
...es/hosting-and-deployment/hosting-on-netlify/netlify-create-new-site-step-2.jpg
Binary file not shown.
Binary file removed
BIN
-36.1 KB
...es/hosting-and-deployment/hosting-on-netlify/netlify-create-new-site-step-3.jpg
Binary file not shown.
Binary file removed
BIN
-18.5 KB
...c/images/hosting-and-deployment/hosting-on-netlify/netlify-deploy-published.jpg
Binary file not shown.
Binary file removed
BIN
-765 KB
static/images/hosting-and-deployment/hosting-on-netlify/netlify-deploying-site.gif
Binary file not shown.
Binary file removed
BIN
-43.3 KB
...ic/images/hosting-and-deployment/hosting-on-netlify/netlify-first-authorize.jpg
Binary file not shown.
Binary file removed
BIN
-36.4 KB
static/images/hosting-and-deployment/hosting-on-netlify/netlify-live-site.jpg
Binary file not shown.
Binary file removed
BIN
-21 KB
static/images/hosting-and-deployment/hosting-on-netlify/netlify-push-to-deploy.jpg
Binary file not shown.
Binary file removed
BIN
-36.2 KB
static/images/hosting-and-deployment/hosting-on-netlify/netlify-signup.jpg
Binary file not shown.