Netlify allows deployment by importing a Git repository from GitHub, GitLab, BitBucket and Azure DevOps or with direct upload .
Deploy on Netlify
After signing up and logging into Netlify :
From the Projects dashboard, choose:
- Import from Git , or
- Deploy manually with upload.
Import from Git
- Choose your Git Provider and connect your account.
- After authentication, select your Alpha repository from the list.
Set the following:
- Project name — This will define your site’s URL:
https://[project-name].netlify.app- In your root
hugo.tomlset
baseURL = "https://[project-name].netlify.app"- Commit and push the change to the Git Provider
- In your root
- Build command:
- With search:
hugo --gc --minify && npx pagefind --site "public"- Without search:
hugo --gc --minify
- Environment variables ( Add key/value pairs)
- Key:
HUGO_VERSION - Value:
0.148.0
Note: Use aHUGO_VERSIONgreater than0.146.1, ideally matching your local version.
- Key:
Click Deploy [project-name].
Once deployment finishes, click View Deploy Project.
Every push to your Git repository will trigger an automatic deployment.
Deploy Manually with upload
- Build your site locally:
- With Search:
hugo --gc --minify && npx pagefind --site "public"- Without Search:
Note: Pagefind search requires Node.js installed locally.hugo --gc --minify - On the Projects page under …or deploy manually click browse to upload.
- Change file type filter from
.zipto All files, then upload your builtpublic/folder. - At the Deploy success! click Get Started
- Navigate to Domain Management → Production Domains.
- Click Options → Edit Project Name to change the autogenerated name to something personal, then click Save.
- Update
baseURLinhugo.toml
baseURL = "https://[project-name].netlify.app"
Attention
For your Hugo site to work, you must rebuild your site with the correct
baseURL and re-upload.For future deployments:
- Build your site locally.
- Navigate to Projects → [your project name].
- Click Deploys –> browse to upload and re-upload the updated
public/folder.
Netlify File Config & Headers (Optional)
Netlify TOML
Netlify settings can be configured not only from the Netlify dashboard but also from a netlify.toml file placed at the root of your project.
Alpha includes a demo netlify.toml file with one base rule: build.command and build.environment.
You’ll find this file at: themes/alpha/netlify.toml
How to Use
- Copy the file from
themes/alpha/netlify.tomlto your site’s root directory (notstatic/, but the actual root of your project). - Customize and expand the configuration as needed for your project.
This file is a starting point. For a complete reference, see the official Netlify netlify.toml documentation .
netlify.toml
netlify.toml override those in the Netlify dashboard.Alpha recommends using the file only for settings that can’t be configured in the UI.
Custom Headers File
Alpha also includes a _headers file preconfigured for a default Alpha installation, located at: themes/alpha/static/_headers.
This file allows you to define HTTP headers for Netlify, including security-related ones.
Refer to the official documentation for syntax details, available options, and best practices..
Warning
How to Use
- Copy the
_headersfile fromthemes/alpha/staticto your site’s ownstatic/directory. - Review and customize the rules to match your site’s security and performance needs.