fb551cc75 Update index.md 7af894857 Update index.md d235753ea Hugo 0.82.1 e03e72deb Merge branch 'temp0821' e62648961 Merge branch 'release-0.82.1' e1ab0f6eb releaser: Add release notes to /docs for release of 0.82.1 5d354c38d Replaced ``` code blocks with Code Toggler c9d065c20 Remove duplicate YAML keys (#1420) 8ae31e701 Add webp image encoding support 848f2af26 Update internal.md (#1407) c103a86a4 Fix `ref` shortcode example output (#1409) 9f8ba56dc Remove leading dot from where function KEY (#1419) 363251a51 Improve presentation of template lookup order (#1382) b73da986d Improve description of Page Resources (#1381) 4e0bb96d5 Rework robots.txt page (#1405) edf893e6f Update migrations.md (#1412) 450f1580b Add link to `site` function doc (#1417) cfffa6e6f Added one extension to the list (#1414) 05f1665a0 Update theme 5de0b1c6a Update theme 250e20552 Add hugo.IsExtended dea5e1fd7 Fix typo on merge function page (#1408) 1bbed2cf3 Update configuration.md be0b64a46 Omit ISO cbb5b8367 Fix `dateFormat` documentation 698f15466 Regenerate the docshelper f9a8a7cb6 Update multilingual.md a22dc6267 Fix grammar (#1398) eb98b0997 Fix pretty URL example (#1397) f4c4153dc Mention date var complementation in post scheduling (#1396) 17fae284c Fix resources.ExecuteAsTemplate argument order (#1394) 97e2c2abb Use code-toggle shortcode in `multilingual.md` (#1388) 3a84929bb Harmonize capitalization (#1393) 17f15daa6 fix file naming used in example (#1392) 5d97b6a18 Add slice syntax to sections permalinks config 00665b97b Improve description of `site.md` edcf5e3fc Fix example in `merge.md` f275ab778 Update postprocess.md 9593e3991 Fix file name 59bd9656f Update postprocess.md 1172fb6d0 Update to theNewDynamic repository (#1263) f5b5c1d2c Update Hugo container image 4f2e92f2a Adapt anchorize.md to Goldmark 98aa19073 Directly link to `highlight` shortcode (#1384) 4c75c2422 Fix header level f15c06f23 markdownify: add note about render-hooks and .RenderString (#1281) 69c82eb68 Remove Blackfriday reference from shortcode desc (#1380) 36de478df Update description of ignoreFiles config setting (#1377) 6337699d8 Remove "Authors" page from documentation (#1371) 35e73ca90 fix indent in example (#1372) d3f01f19a Remove opening body tag from header example (#1376) 341a5a7d8 Update index.md c9bfdbee6 Release 0.82.0 119644949 releaser: Add release notes to /docs for release of 0.82.0 32efaed78 docs: Regenerate docs helper dea5449a2 docs: Regen CLI docs eeab18fce Merge commit '81689af79901f0cdaff765cda6322dd4a9a7ccb3' d508a1259 Attributes for code fences should be placed after the lang indicator only c80905cef deps: Update to esbuild v0.9.0 95350eb79 Add support for Google Analytics v4 02d36f9bc Allow markdown attribute lists to be used in title render hooks 7df220a64 Merge commit '9d31f650da964a52f05fc27b7fb99cf3e09778cf' d80bf61b7 Fixes #7698. git-subtree-dir: docs git-subtree-split: fb551cc750faa83a1493b0e0d0898cd98ab74465
7.7 KiB
title | linktitle | description | date | publishdate | lastmod | categories | keywords | authors | menu | weight | sections_weight | draft | aliases | toc | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Host on Netlify | Host on Netlify | Netlify can host your Hugo site with CDN, continuous deployment, 1-click HTTPS, an admin GUI, and its own CLI. | 2017-02-01 | 2017-02-01 | 2017-03-11 |
|
|
|
|
10 | 10 | false | true |
Netlify provides continuous deployment services, global CDN, ultra-fast DNS, atomic deploys, instant cache invalidation, one-click SSL, a browser-based interface, a CLI, and many other features for managing your Hugo website.
Assumptions
- You have an account with GitHub, GitLab, or Bitbucket.
- You have completed the Quick Start or have a Hugo website you are ready to deploy and share with the world.
- You do not already have a Netlify account.
Create a Netlify account
Go to app.netlify.com and select your preferred signup method. This will likely be a hosted Git provider, although you also have the option to sign up with an email address.
The following examples use GitHub, but other git providers will follow a similar process.
Selecting GitHub will bring up an authorization modal for authentication. Select "Authorize application."
Create a New Site with Continuous Deployment
You're now already a Netlify member and should be brought to your new dashboard. Select "New site from git."
Netlify will then start walking you through the steps necessary for continuous deployment. First, you'll need to select your git provider again, but this time you are giving Netlify added permissions to your repositories.
And then again with the GitHub authorization modal:
Select the repo you want to use for continuous deployment. If you have a large number of repositories, you can filter through them in real time using repo search:
Once selected, you'll be brought to a screen for basic setup. Here you can select the branch you wanted published, your build command, and your publish (i.e. deploy) directory. The publish directory should mirror that of what you've set in your site configuration, the default of which is public
. The following steps assume you are publishing from the master
branch.
Configure Hugo Version in Netlify
You can set Hugo version for your environments in netlify.toml
file or set HUGO_VERSION
as a build environment variable in the Netlify console.
For production:
{{< code-toggle file="netlify" >}} [context.production.environment] HUGO_VERSION = "0.53" {{< /code-toggle >}}
For testing:
[context.deploy-preview.environment]
HUGO_VERSION = "0.53"
The Netlify configuration file can be a little hard to understand and get right for the different environment, and you may get some inspiration and tips from this site's netlify.toml
:
{{< code file="netlify.toml" nocode="true" >}} {{< readfile file="netlify.toml" highlight="toml" >}} {{< /code >}}
Build and Deploy Site
In the Netlify console, selecting "Deploy site" will immediately take you to a terminal for your build:.
Once the build is finished---this should only take a few seconds--you should now see a "Hero Card" at the top of your screen letting you know the deployment is successful. The Hero Card is the first element that you see in most pages. It allows you to see a quick summary of the page and gives access to the most common/pertinent actions and information. You'll see that the URL is automatically generated by Netlify. You can update the URL in "Settings."
Now every time you push changes to your hosted git repository, Netlify will rebuild and redeploy your site.
See this blog post for more details about how Netlify handles Hugo versions.
Use Hugo Themes with Netlify
The git clone
method for installing themes is not supported by Netlify. If you were to use git clone
, it would require you to recursively remove the .git
subdirectory from the theme folder and would therefore prevent compatibility with future versions of the theme.
A better approach is to install a theme as a proper git submodule. You can read the GitHub documentation for submodules or those found on Git's website for more information, but the command is similar to that of git clone
:
cd themes
git submodule add https://github.com/<THEMECREATOR>/<THEMENAME>
It is recommended to only use stable versions of a theme (if it’s versioned) and always check the changelog. This can be done by checking out a specific release within the theme's directory.
Switch to the theme's directory and list all available versions:
cd themes/<theme>
git tag
# exit with q
You can checkout a specific version as follows:
git checkout tags/<version-name>
You can update a theme to the latest version by executing the following command in the root directory of your project:
git submodule update --rebase --remote
Next Steps
You now have a live website served over https, distributed through CDN, and configured for continuous deployment. Dig deeper into the Netlify documentation: