Merge commit '5be51ac3db225d5df501ed1fa1499c41d97dbf65'
8
docs/content/en/host-and-deploy/_index.md
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
title: Host and deploy
|
||||
description: Services and tools to host and deploy your site.
|
||||
categories: []
|
||||
keywords: []
|
||||
weight: 10
|
||||
aliases: [/hosting-and-deployment/]
|
||||
---
|
97
docs/content/en/host-and-deploy/deploy-with-hugo-deploy.md
Normal file
@@ -0,0 +1,97 @@
|
||||
---
|
||||
title: Deploy with hugo
|
||||
description: Deploy your site with the hugo CLI.
|
||||
categories: []
|
||||
keywords: []
|
||||
aliases: [/hosting-and-deployment/hugo-deploy/]
|
||||
---
|
||||
|
||||
Use the `hugo deploy` command to deploy your site Amazon S3, Azure Blob Storage, or Google Cloud Storage.
|
||||
|
||||
> [!note]
|
||||
> This feature requires the Hugo extended/deploy edition. See the [installation] section for details.
|
||||
|
||||
## Assumptions
|
||||
|
||||
1. You have completed the [Quick Start] or have a Hugo website you are ready to deploy and share with the world.
|
||||
1. You have an account with the service provider ([AWS], [Azure], or [Google Cloud]) that you want to deploy to.
|
||||
1. You have authenticated.
|
||||
- AWS: [Install the CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html) and run [`aws configure`](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html).
|
||||
- Azure: [Install the CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli) and run [`az login`](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli).
|
||||
- Google Cloud: [Install the CLI](https://cloud.google.com/sdk) and run [`gcloud auth login`](https://cloud.google.com/sdk/gcloud/reference/auth/login).
|
||||
|
||||
Each service supports various authentication methods, including environment variables. See [details](https://gocloud.dev/howto/blob/#services).
|
||||
|
||||
1. You have created a bucket to deploy to. If you want your site to be
|
||||
public, be sure to configure the bucket to be publicly readable as a static website.
|
||||
- AWS: [create a bucket](https://docs.aws.amazon.com/AmazonS3/latest/gsg/CreatingABucket.html) and [host a static website](https://docs.aws.amazon.com/AmazonS3/latest/userguide/WebsiteHosting.html)
|
||||
- Azure: [create a storage container](https://docs.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-portal) and [host a static website](https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-static-website)
|
||||
|
||||
- Google Cloud: [create a bucket](https://cloud.google.com/storage/docs/creating-buckets) and [host a static website](https://cloud.google.com/storage/docs/hosting-static-website)
|
||||
|
||||
## Configuration
|
||||
|
||||
Create a deployment target in your [site configuration]. The only required parameters are [`name`] and [`url`]:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[deployment]
|
||||
[[deployment.targets]]
|
||||
name = 'production'
|
||||
url = 's3://my_bucket?region=us-west-1'
|
||||
{{< /code-toggle >}}
|
||||
|
||||
## Deploy
|
||||
|
||||
To deploy to a target:
|
||||
|
||||
```bash
|
||||
hugo deploy [--target=<target name>]
|
||||
```
|
||||
|
||||
This command syncs the contents of your local `public` directory (the default publish directory) with the destination bucket. If no target is specified, Hugo deploys to the first configured target.
|
||||
|
||||
For more command-line options, see `hugo help deploy` or the [CLI documentation].
|
||||
|
||||
### File list creation
|
||||
|
||||
`hugo deploy` creates local and remote file lists by traversing the local publish directory and the remote bucket. Inclusion and exclusion are determined by the deployment target's [configuration]:
|
||||
|
||||
- `include`: All files are skipped by default except those that match the pattern.
|
||||
- `exclude`: Files matching the pattern are skipped.
|
||||
|
||||
> [!note]
|
||||
> During local file list creation, Hugo skips `.DS_Store` files and hidden directories (those starting with a period, like `.git`), except for the [`.well-known`] directory, which is traversed if present.
|
||||
|
||||
### File list comparison
|
||||
|
||||
Hugo compares the local and remote file lists to identify necessary changes. It first compares file names. If both exist, it compares sizes and MD5 checksums. Any difference triggers a re-upload, and remote files not present locally are deleted.
|
||||
|
||||
> [!note]
|
||||
> Excluded remote files (due to `include`/`exclude` configuration) won't be deleted.
|
||||
|
||||
The `--force` flag forces all files to be re-uploaded, even if Hugo detects no local/remote differences.
|
||||
|
||||
The `--confirm` or `--dryRun` flags cause Hugo to display the detected differences and then pause or stop.
|
||||
|
||||
### Synchronization
|
||||
|
||||
Hugo applies the changes to the remote bucket: uploading missing or changed files and deleting remote files not present locally. Uploaded file headers are configured remotely based on the matchers configuration.
|
||||
|
||||
> [!note]
|
||||
> To prevent accidental data loss, Hugo will not delete more than 256 remote files by default. Use the `--maxDeletes` flag to override this limit.
|
||||
|
||||
## Advanced configuration
|
||||
|
||||
See [configure deployment](/configuration/deployment/).
|
||||
|
||||
[`.well-known`]: https://en.wikipedia.org/wiki/Well-known_URI
|
||||
[`name`]: /configuration/deployment/#name
|
||||
[`url`]: /configuration/deployment/#url
|
||||
[AWS]: https://aws.amazon.com
|
||||
[Azure]: https://azure.microsoft.com
|
||||
[CLI documentation]: /commands/hugo_deploy/
|
||||
[configuration]: /configuration/deployment/#targets-1
|
||||
[Google Cloud]: https://cloud.google.com/
|
||||
[installation]: /installation/
|
||||
[Quick Start]: /getting-started/quick-start/
|
||||
[site configuration]: /configuration/deployment/
|
43
docs/content/en/host-and-deploy/deploy-with-rclone.md
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
title: Deploy with rclone
|
||||
description: Deploy your site with the rclone CLI.
|
||||
categories: []
|
||||
keywords: []
|
||||
aliases: [/hosting-and-deployment/deployment-with-rclone/]
|
||||
---
|
||||
|
||||
## Assumptions
|
||||
|
||||
- A web host running a web server. This could be a shared hosting environment or a VPS.
|
||||
- Access to your web host with any of the [protocols supported by rclone](https://rclone.org/#providers), such as SFTP.
|
||||
- A functional static website built with Hugo
|
||||
- Deploying from an [Rclone](https://rclone.org) compatible operating system
|
||||
- You have [installed Rclone](https://rclone.org/install/).
|
||||
|
||||
**NB**: You can remove ``--interactive`` in the commands below once you are comfortable with rclone, if you wish. Also, ``--gc`` and ``--minify`` are optional in the ``hugo`` commands below.
|
||||
|
||||
## Getting started
|
||||
|
||||
The spoiler is that you can even deploy your entire website from any compatible OS with no configuration. Using SFTP for example:
|
||||
|
||||
```txt
|
||||
hugo --gc --minify
|
||||
rclone sync --interactive --sftp-host sftp.example.com --sftp-user www-data --sftp-ask-password public/ :sftp:www/
|
||||
```
|
||||
|
||||
## Configure Rclone for even easier usage
|
||||
|
||||
The easiest way is simply to run `rclone config`.
|
||||
|
||||
The [Rclone docs](https://rclone.org/docs/) provide [an example of configuring Rclone to use SFTP](https://rclone.org/sftp/).
|
||||
|
||||
For the next commands, we will assume you configured a remote you named ``hugo-www``
|
||||
|
||||
The above 'spoiler' commands could become:
|
||||
|
||||
```txt
|
||||
hugo --gc --minify
|
||||
rclone sync --interactive public/ hugo-www:www/
|
||||
```
|
||||
|
||||
After you issue the above commands (and respond to any prompts), check your website and you will see that it is deployed.
|
135
docs/content/en/host-and-deploy/deploy-with-rsync.md
Normal file
@@ -0,0 +1,135 @@
|
||||
---
|
||||
title: Deploy with rsync
|
||||
description: Deploy your site with the rsync CLI.
|
||||
categories: []
|
||||
keywords: []
|
||||
aliases: [/hosting-and-deployment/deployment-with-rsync/]
|
||||
---
|
||||
|
||||
## Assumptions
|
||||
|
||||
- A web host running a web server. This could be a shared hosting environment or a VPS.
|
||||
- Access to your web host with SSH
|
||||
- A functional static website built with Hugo
|
||||
|
||||
The spoiler is that you can deploy your entire website with a command that looks like the following:
|
||||
|
||||
```txt
|
||||
hugo && rsync -avz --delete public/ www-data@ftp.topologix.fr:~/www/
|
||||
```
|
||||
|
||||
As you will see, we'll put this command in a shell script file, which makes building and deployment as easy as executing `./deploy`.
|
||||
|
||||
## Copy Your SSH Key to your host
|
||||
|
||||
To make logging in to your server more secure and less interactive, you can upload your SSH key. If you have already installed your SSH key to your server, you can move on to the next section.
|
||||
|
||||
First, install the ssh client. On Debian distributions, use the following command:
|
||||
|
||||
```sh {file="install-openssh.sh"}
|
||||
sudo apt-get install openssh-client
|
||||
```
|
||||
|
||||
Then generate your ssh key. First, create the `.ssh` directory in your home directory if it doesn't exist:
|
||||
|
||||
```txt
|
||||
~$ cd && mkdir .ssh & cd .ssh
|
||||
```
|
||||
|
||||
Next, execute this command to generate a new keypair called `rsa_id`:
|
||||
|
||||
```txt
|
||||
~/.ssh/$ ssh-keygen -t rsa -q -C "For SSH" -f rsa_id
|
||||
```
|
||||
|
||||
You'll be prompted for a passphrase, which is an extra layer of protection. Enter the passphrase you'd like to use, and then enter it again when prompted, or leave it blank if you don't want to have a passphrase. Not using a passphrase will let you transfer files non-interactively, as you won't be prompted for a password when you log in, but it is slightly less secure.
|
||||
|
||||
To make logging in easier, add a definition for your web host to the file `~/.ssh/config` with the following command, replacing `HOST` with the IP address or hostname of your web host, and `USER` with the username you use to log in to your web host when transferring files:
|
||||
|
||||
```txt
|
||||
~/.ssh/$ cat >> config <<EOF
|
||||
Host HOST
|
||||
Hostname HOST
|
||||
Port 22
|
||||
User USER
|
||||
IdentityFile ~/.ssh/rsa_id
|
||||
EOF
|
||||
```
|
||||
|
||||
Then copy your ssh public key to the remote server with the `ssh-copy-id` command:
|
||||
|
||||
```txt
|
||||
~/.ssh/$ ssh-copy-id -i rsa_id.pub USER@HOST.com
|
||||
```
|
||||
|
||||
Now you can easily connect to the remote server:
|
||||
|
||||
```txt
|
||||
~$ ssh user@host
|
||||
Enter passphrase for key '/home/mylogin/.ssh/rsa_id':
|
||||
```
|
||||
|
||||
Now that you can log in with your SSH key, let's create a script to automate deployment of your Hugo site.
|
||||
|
||||
## Shell script
|
||||
|
||||
Create a new script called `deploy` the root of your Hugo tree:
|
||||
|
||||
```txt
|
||||
~/websites/topologix.fr$ editor deploy
|
||||
```
|
||||
|
||||
Add the following content. Replace the `USER`, `HOST`, and `DIR` values with your own values:
|
||||
|
||||
```sh
|
||||
#!/bin/sh
|
||||
USER=my-user
|
||||
HOST=my-server.com
|
||||
DIR=my/directory/to/topologix.fr/ # the directory where your website files should go
|
||||
|
||||
hugo && rsync -avz --delete public/ ${USER}@${HOST}:~/${DIR} # this will delete everything on the server that's not in the local public directory
|
||||
|
||||
exit 0
|
||||
```
|
||||
|
||||
Note that `DIR` is the relative path from the remote user's home. If you have to specify a full path (for instance `/var/www/mysite/`) you must change `~/${DIR}` to `${DIR}` inside the command-line. For most cases you should not have to.
|
||||
|
||||
Save and close, and make the `deploy` file executable:
|
||||
|
||||
```txt
|
||||
~/websites/topologix.fr$ chmod +x deploy
|
||||
```
|
||||
|
||||
Now you only have to enter the following command to deploy and update your website:
|
||||
|
||||
```txt
|
||||
~/websites/topologix.fr$ ./deploy
|
||||
```
|
||||
|
||||
Your site builds and deploys:
|
||||
|
||||
```txt
|
||||
Started building sites ...
|
||||
Built site for language en:
|
||||
0 draft content
|
||||
0 future content
|
||||
0 expired content
|
||||
5 pages created
|
||||
0 non-page files copied
|
||||
0 paginator pages created
|
||||
0 tags created
|
||||
0 categories created
|
||||
total in 56 ms
|
||||
sending incremental file list
|
||||
404.html
|
||||
index.html
|
||||
index.xml
|
||||
sitemap.xml
|
||||
posts/
|
||||
posts/index.html
|
||||
|
||||
sent 9,550 bytes received 1,708 bytes 7,505.33 bytes/sec
|
||||
total size is 966,557 speedup is 85.86
|
||||
```
|
||||
|
||||
You can incorporate other processing tasks into this deployment script as well.
|
52
docs/content/en/host-and-deploy/host-on-21yunbox.md
Normal file
@@ -0,0 +1,52 @@
|
||||
---
|
||||
title: Host on 21YunBox
|
||||
description: Host your site on 21YunBox.
|
||||
categories: []
|
||||
keywords: []
|
||||
aliases: [/hosting-and-deployment/hosting-on-21yunbox/]
|
||||
---
|
||||
|
||||
[21YunBox](https://www.21cloudbox.com/) is a fully-managed cloud platform dedicated to make web deployment easy within the Chinese Great Firewall where you can host static sites, backend APIs, databases, cron jobs, and all your other apps in one place. It provides blazing fast Chinese CDN, continuous deployment, one-click HTTPS and [other services like managed databases and backend web services](https://www.21cloudbox.com/docs/), providing an avenue to launch web projects in China.
|
||||
|
||||
21YunBox includes the following features:
|
||||
|
||||
- Continuous, automatic builds & deploys from GitHub and Gitee
|
||||
- Automatic SSL certificates through [Let's Encrypt](https://letsencrypt.org)
|
||||
- Instant cache invalidation with a blazing fast, Chinese CDN
|
||||
- Unlimited [custom domains](https://www.21cloudbox.com/dns-configuration.html)
|
||||
- Automatic [Brotli compression](https://en.wikipedia.org/wiki/Brotli) for faster sites
|
||||
- Native HTTP/2 support
|
||||
- Automatic HTTP → HTTPS redirects
|
||||
- Custom URL redirects and rewrites
|
||||
|
||||
## Prerequisites
|
||||
|
||||
This guide assumes you already have a Hugo project to deploy. If you need a project, use the [Quick Start](/getting-started/quick-start/) to get started or fork 21YunBox's [Hugo Example](https://gitee.com/eryiyunbox-examples/hello-hugo) before continuing.
|
||||
|
||||
## Setup
|
||||
|
||||
You can set up a Hugo site on 21YunBox in two quick steps:
|
||||
|
||||
1. Create a new web service on 21YunBox, and give 21YunBox permission to access your GitHub or Gitee repo.
|
||||
1. Use the following values during creation:<!-- do not insert blank line -->
|
||||
| Field | Value |
|
||||
| ----------------- | ------------------------------------------------ |
|
||||
| Environment | `Static Site` |
|
||||
| Build Command | `hugo --gc --minify` (or your own build command) |
|
||||
| Publish Directory | `./public` (or your own output directory) |
|
||||
|
||||
That's it! Your site will be live on your 21YunBox URL (which looks like `yoursite.21yunbox.com`) as soon as the build is done.
|
||||
|
||||
## Continuous deploys
|
||||
|
||||
Now that 21YunBox is connected to your repo, it will automatically build and publish your site any time you push to GitHub.
|
||||
|
||||
Every deploy automatically and instantly invalidates the CDN cache, so your users can always access the latest content on your site.
|
||||
|
||||
## Custom domains
|
||||
|
||||
Add your own domains to your site easily using 21YunBox's [custom domains](https://www.21cloudbox.com/dns-configuration.html) guide.
|
||||
|
||||
## Support
|
||||
|
||||
Click [here](https://www.21cloudbox.com/contact.html) to contact with 21YunBox' experts if you need help.
|
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 60 KiB |
160
docs/content/en/host-and-deploy/host-on-aws-amplify/index.md
Normal file
@@ -0,0 +1,160 @@
|
||||
---
|
||||
title: Host on AWS Amplify
|
||||
description: Host your site on AWS Amplify.
|
||||
categories: []
|
||||
keywords: []
|
||||
aliases: [/hosting-and-deployment/hosting-on-aws-amplify/]
|
||||
---
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Please complete the following tasks before continuing:
|
||||
|
||||
1. [Create an AWS account]
|
||||
1. [Install Git]
|
||||
1. [Create a Hugo site] and test it locally with `hugo server`
|
||||
1. Commit the changes to your local repository
|
||||
1. 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 an AWS account]: https://aws.amazon.com/resources/create-account/
|
||||
[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
|
||||
|
||||
Create a file named `amplify.yml` in the root of your project.
|
||||
|
||||
```sh
|
||||
touch amplify.yml
|
||||
```
|
||||
|
||||
### Step 2
|
||||
|
||||
Copy and paste the YAML below into the file you created. Change the application versions and time zone as needed.
|
||||
|
||||
```yaml {file="amplify.yml" copy=true}
|
||||
version: 1
|
||||
env:
|
||||
variables:
|
||||
# Application versions
|
||||
DART_SASS_VERSION: 1.85.0
|
||||
GO_VERSION: 1.23.3
|
||||
HUGO_VERSION: 0.144.2
|
||||
# Time zone
|
||||
TZ: America/Los_Angeles
|
||||
# Cache
|
||||
HUGO_CACHEDIR: ${PWD}/.hugo
|
||||
NPM_CONFIG_CACHE: ${PWD}/.npm
|
||||
frontend:
|
||||
phases:
|
||||
preBuild:
|
||||
commands:
|
||||
# Install Dart Sass
|
||||
- curl -LJO https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz
|
||||
- sudo tar -C /usr/local/bin -xf dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz
|
||||
- rm dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz
|
||||
- export PATH=/usr/local/bin/dart-sass:$PATH
|
||||
|
||||
# Install Go
|
||||
- curl -LJO https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz
|
||||
- sudo tar -C /usr/local -xf go${GO_VERSION}.linux-amd64.tar.gz
|
||||
- rm go${GO_VERSION}.linux-amd64.tar.gz
|
||||
- export PATH=/usr/local/go/bin:$PATH
|
||||
|
||||
# Install Hugo
|
||||
- curl -LJO https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz
|
||||
- sudo tar -C /usr/local/bin -xf hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz
|
||||
- rm hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz
|
||||
- export PATH=/usr/local/bin:$PATH
|
||||
|
||||
# Check installed versions
|
||||
- go version
|
||||
- hugo version
|
||||
- node -v
|
||||
- npm -v
|
||||
- sass --embedded --version
|
||||
|
||||
# Install Node.JS dependencies
|
||||
- "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci --prefer-offline || true"
|
||||
|
||||
# https://github.com/gohugoio/hugo/issues/9810
|
||||
- git config --add core.quotepath false
|
||||
build:
|
||||
commands:
|
||||
- hugo --gc --minify
|
||||
artifacts:
|
||||
baseDirectory: public
|
||||
files:
|
||||
- '**/*'
|
||||
cache:
|
||||
paths:
|
||||
- ${HUGO_CACHEDIR}/**/*
|
||||
- ${NPM_CONFIG_CACHE}/**/*
|
||||
```
|
||||
|
||||
### Step 3
|
||||
|
||||
Commit and push the change to your GitHub repository.
|
||||
|
||||
```sh
|
||||
git add -A
|
||||
git commit -m "Create amplify.yml"
|
||||
git push
|
||||
```
|
||||
|
||||
### Step 4
|
||||
|
||||
Log in to your AWS account, navigate to the [Amplify Console], then press the **Deploy an app** button.
|
||||
|
||||
[Amplify Console]: https://console.aws.amazon.com/amplify/apps
|
||||
|
||||
### Step 5
|
||||
|
||||
Choose a source code provider, then press the **Next** button.
|
||||
|
||||

|
||||
|
||||
### Step 6
|
||||
|
||||
Authorize AWS Amplify to access your GitHub account.
|
||||
|
||||

|
||||
|
||||
### Step 7
|
||||
|
||||
Select your personal account or relevant organization.
|
||||
|
||||

|
||||
|
||||
### Step 8
|
||||
|
||||
Authorize access to one or more repositories.
|
||||
|
||||

|
||||
|
||||
### Step 9
|
||||
|
||||
Select a repository and branch, then press the **Next** button.
|
||||
|
||||

|
||||
|
||||
### Step 10
|
||||
|
||||
On the "App settings" page, scroll to the bottom then press the **Next** button. Amplify reads the `amplify.yml` file you created in Steps 1-3 instead of using the values on this page.
|
||||
|
||||
### Step 11
|
||||
|
||||
On the "Review" page, scroll to the bottom then press the **Save and deploy** button.
|
||||
|
||||
### Step 12
|
||||
|
||||
When your site has finished deploying, press the **Visit deployed URL** button to view your published site.
|
||||
|
||||

|
@@ -0,0 +1,11 @@
|
||||
---
|
||||
title: Host on Azure Static Web Apps
|
||||
description: Host your site on Azure Static Web Apps.
|
||||
categories: []
|
||||
keywords: []
|
||||
aliases: [/hosting-and-deployment/hosting-on-azure-static-web-apps/]
|
||||
---
|
||||
|
||||
You can create and deploy a Hugo web application to Azure Static Web Apps. The final result is a new Azure Static Web App with associated GitHub Actions that give you control over how the app is built and published. You'll learn how to create a Hugo app, set up an Azure Static Web App and deploy the Hugo app to Azure.
|
||||
|
||||
Here's the tutorial on how to [Publish a Hugo site to Azure Static Web Apps](https://docs.microsoft.com/en-us/azure/static-web-apps/publish-hugo).
|
11
docs/content/en/host-and-deploy/host-on-cloudflare-pages.md
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
title: Host on Cloudflare Pages
|
||||
description: Host your site on Cloudflare Pages.
|
||||
categories: []
|
||||
keywords: []
|
||||
aliases: [/hosting-and-deployment/hosting-on-cloudflare-pages/]
|
||||
---
|
||||
|
||||
[Cloudflare Pages](https://developers.cloudflare.com/pages/) are super fast, always up-to-date, and deployed directly from your [Git provider](https://developers.cloudflare.com/pages/get-started/#connect-your-git-provider-to-pages).
|
||||
|
||||
Cloudflare Pages docs have a detailed tutorial on [how to deploy a Hugo site](https://developers.cloudflare.com/pages/framework-guides/deploy-a-hugo-site/).
|
82
docs/content/en/host-and-deploy/host-on-codeberg-pages.md
Normal file
@@ -0,0 +1,82 @@
|
||||
---
|
||||
title: Host on Codeberg Pages
|
||||
description: Host your site on Codeberg Pages.
|
||||
categories: []
|
||||
keywords: []
|
||||
aliases: [/hosting-and-deployment/hosting-on-codeberg/]
|
||||
---
|
||||
|
||||
## Assumptions
|
||||
|
||||
- Working familiarity with [Git] for version control
|
||||
- Completion of the Hugo [Quick Start]
|
||||
- A [Codeberg account]
|
||||
- A Hugo website on your local machine that you are ready to publish
|
||||
|
||||
[Codeberg account]: https://codeberg.org/user/login/
|
||||
[Git]: https://git-scm.com/
|
||||
[Quick Start]: /getting-started/quick-start/
|
||||
|
||||
Any and all mentions of `<YourUsername>` refer to your actual Codeberg username and must be substituted accordingly. Likewise, `<YourWebsite>` represents your actual website name.
|
||||
|
||||
## BaseURL
|
||||
|
||||
The [`baseURL`] in your site configuration must reflect the full URL provided by Codeberg Pages if using the default address (e.g. `https://<YourUsername>.codeberg.page/`). If you want to use another domain, follow the instructions in the [custom domain section] of the official documentation.
|
||||
|
||||
[`baseURL`]: /configuration/all/#baseurl
|
||||
[custom domain section]: https://docs.codeberg.org/codeberg-pages/using-custom-domain/
|
||||
|
||||
For more details regarding the URL of your deployed website, refer to Codeberg Pages' [quickstart instructions].
|
||||
|
||||
[quickstart instructions]: https://codeberg.page/
|
||||
|
||||
## Manual deployment
|
||||
|
||||
Create a public repository on your Codeberg account titled `pages` or create a branch of the same name in an existing public repository. Finally, push the contents of Hugo's output directory (by default, `public`) to it. Here's an example:
|
||||
|
||||
```sh
|
||||
# build the website
|
||||
hugo
|
||||
|
||||
# access the output directory
|
||||
cd public
|
||||
|
||||
# initialize new git repository
|
||||
git init
|
||||
|
||||
# commit and push code to main branch
|
||||
git add .
|
||||
git commit -m "Initial commit"
|
||||
git remote add origin https://codeberg.org/<YourUsername>/pages.git
|
||||
git push -u origin main
|
||||
```
|
||||
|
||||
## Automated deployment
|
||||
|
||||
In order to automatically deploy your Hugo website, you need to have or [request] access to Codeberg's CI, as well as add a `.woodpecker.yaml` file in the root of your project. A template and additional instructions are available in the official [examples repository].
|
||||
|
||||
[request]: https://codeberg.org/Codeberg-e.V./requests/issues/new?template=ISSUE_TEMPLATE%2fWoodpecker-CI.yaml
|
||||
[examples repository]: https://codeberg.org/Codeberg-CI/examples/src/branch/main/Hugo/.woodpecker.yaml
|
||||
|
||||
In this case, you must create a public repository on Codeberg (e.g. `<YourWebsite>`) and push your local project to it. Here's an example:
|
||||
|
||||
```sh
|
||||
# initialize new git repository
|
||||
git init
|
||||
|
||||
# add /public directory to our .gitignore file
|
||||
echo "/public" >> .gitignore
|
||||
|
||||
# commit and push code to main branch
|
||||
git add .
|
||||
git commit -m "Initial commit"
|
||||
git remote add origin https://codeberg.org/<YourUsername>/<YourWebsite>.git
|
||||
git push -u origin main
|
||||
```
|
||||
|
||||
Your project will then be built and deployed by Codeberg's CI.
|
||||
|
||||
## Other resources
|
||||
|
||||
- [Codeberg Pages](https://codeberg.page/)
|
||||
- [Codeberg Pages official documentation](https://docs.codeberg.org/codeberg-pages/)
|
106
docs/content/en/host-and-deploy/host-on-firebase.md
Normal file
@@ -0,0 +1,106 @@
|
||||
---
|
||||
title: Host on Firebase
|
||||
description: Host your site on Firebase.
|
||||
categories: []
|
||||
keywords: []
|
||||
aliases: [/hosting-and-deployment/hosting-on-firebase/]
|
||||
---
|
||||
|
||||
## Assumptions
|
||||
|
||||
1. You have an account with [Firebase][signup]. (If you don't, you can sign up for free using your Google account.)
|
||||
1. You have completed the [Quick Start] or have a completed Hugo website ready for deployment.
|
||||
|
||||
## Initial setup
|
||||
|
||||
Go to the [Firebase console][console] and create a new project (unless you already have a project). You will need to globally install `firebase-tools` (node.js):
|
||||
|
||||
```sh
|
||||
npm install -g firebase-tools
|
||||
```
|
||||
|
||||
Log in to Firebase (setup on your local machine) using `firebase login`, which opens a browser where you can select your account. Use `firebase logout` in case you are already logged in but to the wrong account.
|
||||
|
||||
```sh
|
||||
firebase login
|
||||
```
|
||||
|
||||
In the root of your Hugo project, initialize the Firebase project with the `firebase init` command:
|
||||
|
||||
```sh
|
||||
firebase init
|
||||
```
|
||||
|
||||
From here:
|
||||
|
||||
1. Choose Hosting in the feature question
|
||||
1. Choose the project you just set up
|
||||
1. Accept the default for your database rules file
|
||||
1. Accept the default for the publish directory, which is `public`
|
||||
1. Choose "No" in the question if you are deploying a single-page app
|
||||
|
||||
## Using Firebase & GitHub CI/CD
|
||||
|
||||
In new versions of Firebase, some other questions apply:
|
||||
|
||||
6. Set up automatic builds and deploys with GitHub?
|
||||
|
||||
Here you will be redirected to login in your GitHub account to get permissions. Confirm.
|
||||
|
||||
7. For which GitHub repository would you like to set up a GitHub workflow? (format: user/repository)
|
||||
|
||||
Include the repository you will use in the format above (Account/Repo)
|
||||
Firebase script with retrieve credentials, create a service account you can later manage in your GitHub settings.
|
||||
|
||||
8. Set up the workflow to run a build script before every deploy?
|
||||
|
||||
Here is your opportunity to include some commands before you run the deploy.
|
||||
|
||||
9. Set up automatic deployment to your site's live channel when a PR is merged?
|
||||
|
||||
You can let in the default option (main)
|
||||
|
||||
After that Firebase has been set in your project with [CI/CD](g). After that run:
|
||||
|
||||
```sh
|
||||
hugo && firebase deploy
|
||||
```
|
||||
|
||||
With this you will have the app initialized manually. After that you can manage and fix your GitHub workflow from: https://github.com/your-account/your-repo/actions
|
||||
|
||||
Don't forget to update your static pages before push!
|
||||
|
||||
## Manual deploy
|
||||
|
||||
To deploy your Hugo site, execute the `firebase deploy` command, and your site will be up in no time:
|
||||
|
||||
```sh
|
||||
hugo && firebase deploy
|
||||
```
|
||||
|
||||
## CI setup (other tools)
|
||||
|
||||
You can generate a deploy token using
|
||||
|
||||
```sh
|
||||
firebase login:ci
|
||||
```
|
||||
|
||||
You can also set up your CI and add the token to a private variable like `$FIREBASE_DEPLOY_TOKEN`.
|
||||
|
||||
> [!note]
|
||||
> This is a private secret and it should not appear in a public repository. Make sure you understand your chosen CI and that it's not visible to others.
|
||||
|
||||
You can then add a step in your build to do the deployment using the token:
|
||||
|
||||
```sh
|
||||
firebase deploy --token $FIREBASE_DEPLOY_TOKEN
|
||||
```
|
||||
|
||||
## Reference links
|
||||
|
||||
- [Firebase CLI Reference](https://firebase.google.com/docs/cli/#administrative_commands)
|
||||
|
||||
[console]: https://console.firebase.google.com/
|
||||
[Quick Start]: /getting-started/quick-start/
|
||||
[signup]: https://console.firebase.google.com/
|
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 6.2 KiB |
After Width: | Height: | Size: 6.1 KiB |
After Width: | Height: | Size: 4.7 KiB |
230
docs/content/en/host-and-deploy/host-on-github-pages/index.md
Normal file
@@ -0,0 +1,230 @@
|
||||
---
|
||||
title: Host on GitHub Pages
|
||||
description: Host your site on GitHub Pages.
|
||||
categories: []
|
||||
keywords: []
|
||||
aliases: [/hosting-and-deployment/hosting-on-github/]
|
||||
---
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Please complete the following tasks before continuing:
|
||||
|
||||
1. [Create a GitHub account]
|
||||
1. [Install Git]
|
||||
1. [Create a Hugo site] and test it locally with `hugo server`.
|
||||
|
||||
## Types of sites
|
||||
|
||||
There are three types of GitHub Pages sites: project, user, and organization. Project sites are connected to a specific project hosted on GitHub. User and organization sites are connected to a specific account on GitHub.com.
|
||||
|
||||
> [!note]
|
||||
> See the [GitHub Pages documentation] to understand the requirements for repository ownership and naming.
|
||||
|
||||
## Procedure
|
||||
|
||||
### Step 1
|
||||
|
||||
Create a GitHub repository.
|
||||
|
||||
### Step 2
|
||||
|
||||
Push your local repository to GitHub.
|
||||
|
||||
### Step 3
|
||||
|
||||
Visit your GitHub repository. From the main menu choose **Settings** > **Pages**. In the center of your screen you will see this:
|
||||
|
||||

|
||||
{style="max-width: 280px"}
|
||||
|
||||
### Step 4
|
||||
|
||||
Change the **Source** to `GitHub Actions`. The change is immediate; you do not have to press a Save button.
|
||||
|
||||

|
||||
{style="max-width: 280px"}
|
||||
|
||||
### Step 5
|
||||
|
||||
In your site configuration, change the location of the image cache to the [`cacheDir`] as shown below:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[caches.images]
|
||||
dir = ":cacheDir/images"
|
||||
{{< /code-toggle >}}
|
||||
|
||||
See [configure file caches] for more information.
|
||||
|
||||
### Step 6
|
||||
|
||||
Create a file named `hugo.yaml` in a directory named `.github/workflows`.
|
||||
|
||||
```text
|
||||
mkdir -p .github/workflows
|
||||
touch .github/workflows/hugo.yaml
|
||||
```
|
||||
|
||||
### Step 7
|
||||
|
||||
> [!note]
|
||||
> The workflow below ensures Hugo's `cacheDir` is persistent, preserving modules, processed images, and [`resources.GetRemote`] data between builds.
|
||||
|
||||
Copy and paste the YAML below into the file you created. Change the branch name and Hugo version as needed.
|
||||
|
||||
```yaml {file=".github/workflows/hugo.yaml" copy=true}
|
||||
# Sample workflow for building and deploying a Hugo site to GitHub Pages
|
||||
name: Deploy Hugo site to Pages
|
||||
|
||||
on:
|
||||
# Runs on pushes targeting the default branch
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
|
||||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
|
||||
concurrency:
|
||||
group: "pages"
|
||||
cancel-in-progress: false
|
||||
|
||||
# Default to bash
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
jobs:
|
||||
# Build job
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
HUGO_VERSION: 0.145.0
|
||||
HUGO_ENVIRONMENT: production
|
||||
TZ: America/Los_Angeles
|
||||
steps:
|
||||
- name: Install Hugo CLI
|
||||
run: |
|
||||
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
|
||||
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
|
||||
- name: Install Dart Sass
|
||||
run: sudo snap install dart-sass
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
- name: Setup Pages
|
||||
id: pages
|
||||
uses: actions/configure-pages@v5
|
||||
- name: Install Node.js dependencies
|
||||
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
|
||||
- name: Cache Restore
|
||||
id: cache-restore
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: |
|
||||
${{ runner.temp }}/hugo_cache
|
||||
key: hugo-${{ github.run_id }}
|
||||
restore-keys:
|
||||
hugo-
|
||||
- name: Build with Hugo
|
||||
run: |
|
||||
hugo \
|
||||
--gc \
|
||||
--minify \
|
||||
--baseURL "${{ steps.pages.outputs.base_url }}/" \
|
||||
--cacheDir "${{ runner.temp }}/hugo_cache"
|
||||
- name: Cache Save
|
||||
id: cache-save
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: |
|
||||
${{ runner.temp }}/hugo_cache
|
||||
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
path: ./public
|
||||
|
||||
# Deployment job
|
||||
deploy:
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v4
|
||||
```
|
||||
|
||||
### Step 8
|
||||
|
||||
Commit and push the change to your GitHub repository.
|
||||
|
||||
```sh
|
||||
git add -A
|
||||
git commit -m "Create hugo.yaml"
|
||||
git push
|
||||
```
|
||||
|
||||
### Step 9
|
||||
|
||||
From GitHub's main menu, choose **Actions**. You will see something like this:
|
||||
|
||||

|
||||
{style="max-width: 350px"}
|
||||
|
||||
### Step 10
|
||||
|
||||
When GitHub has finished building and deploying your site, the color of the status indicator will change to green.
|
||||
|
||||

|
||||
{style="max-width: 350px"}
|
||||
|
||||
### Step 11
|
||||
|
||||
Click on the commit message as shown above. You will see this:
|
||||
|
||||

|
||||
{style="max-width: 611px"}
|
||||
|
||||
Under the deploy step, you will see a link to your live site.
|
||||
|
||||
In the future, whenever you push a change from your local repository, GitHub will rebuild your site and deploy the changes.
|
||||
|
||||
## Customize the workflow
|
||||
|
||||
The example workflow above includes this step, which typically takes 10‑15 seconds:
|
||||
|
||||
```yaml
|
||||
- name: Install Dart Sass
|
||||
run: sudo snap install dart-sass
|
||||
```
|
||||
|
||||
You may remove this step if your site, themes, and modules do not transpile Sass to CSS using the [Dart Sass] transpiler.
|
||||
|
||||
## Other resources
|
||||
|
||||
- [Learn more about GitHub Actions](https://docs.github.com/en/actions)
|
||||
- [Caching dependencies to speed up workflows](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows)
|
||||
- [Manage a custom domain for your GitHub Pages site](https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site/about-custom-domains-and-github-pages)
|
||||
|
||||
[Create a GitHub account]: https://github.com/signup
|
||||
[Create a Hugo site]: /getting-started/quick-start/
|
||||
[Dart Sass]: /functions/css/sass/#dart-sass
|
||||
[GitHub Pages documentation]: https://docs.github.com/en/pages/getting-started-with-github-pages/about-github-pages#types-of-github-pages-sites
|
||||
[Install Git]: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
|
||||
[`cacheDir`]: /configuration/all/#cachedir
|
||||
[`resources.GetRemote`]: /functions/resources/getremote/
|
||||
[configure file caches]: /configuration/caches/
|
96
docs/content/en/host-and-deploy/host-on-gitlab-pages.md
Normal file
@@ -0,0 +1,96 @@
|
||||
---
|
||||
title: Host on GitLab Pages
|
||||
description: Host your site on GitLab Pages.
|
||||
categories: []
|
||||
keywords: []
|
||||
aliases: [/hosting-and-deployment/hosting-on-gitlab/]
|
||||
---
|
||||
|
||||
## Assumptions
|
||||
|
||||
- Working familiarity with Git for version control
|
||||
- Completion of the Hugo [Quick Start]
|
||||
- A [GitLab account](https://gitlab.com/users/sign_in)
|
||||
- A Hugo website on your local machine that you are ready to publish
|
||||
|
||||
## BaseURL
|
||||
|
||||
The `baseURL` in your [site configuration](/configuration/) must reflect the full URL of your GitLab pages repository if you are using the default GitLab Pages URL (e.g., `https://<YourUsername>.gitlab.io/<your-hugo-site>/`) and not a custom domain.
|
||||
|
||||
## Configure GitLab CI/CD
|
||||
|
||||
Define your [CI/CD](g) jobs by creating a `.gitlab-ci.yml` file in the root of your project.
|
||||
|
||||
```yaml {file=".gitlab-ci.yml" copy=true}
|
||||
variables:
|
||||
DART_SASS_VERSION: 1.85.0
|
||||
GIT_DEPTH: 0
|
||||
GIT_STRATEGY: clone
|
||||
GIT_SUBMODULE_STRATEGY: recursive
|
||||
HUGO_VERSION: 0.144.2
|
||||
NODE_VERSION: 23.x
|
||||
TZ: America/Los_Angeles
|
||||
image:
|
||||
name: golang:1.23.4-bookworm
|
||||
|
||||
pages:
|
||||
script:
|
||||
# Install brotli
|
||||
- apt-get update
|
||||
- apt-get install -y brotli
|
||||
# Install Dart Sass
|
||||
- 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
|
||||
- cp -r dart-sass/ /usr/local/bin
|
||||
- rm -rf dart-sass*
|
||||
- export PATH=/usr/local/bin/dart-sass:$PATH
|
||||
# Install Hugo
|
||||
- curl -LJO https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb
|
||||
- apt-get install -y ./hugo_extended_${HUGO_VERSION}_linux-amd64.deb
|
||||
- rm hugo_extended_${HUGO_VERSION}_linux-amd64.deb
|
||||
# Install Node.js
|
||||
- curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION} | bash -
|
||||
- apt-get install -y nodejs
|
||||
# Install Node.js dependencies
|
||||
- "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
|
||||
# Build
|
||||
- hugo --gc --minify --baseURL ${CI_PAGES_URL}
|
||||
# Compress
|
||||
- find public -type f -regex '.*\.\(css\|html\|js\|txt\|xml\)$' -exec gzip -f -k {} \;
|
||||
- find public -type f -regex '.*\.\(css\|html\|js\|txt\|xml\)$' -exec brotli -f -k {} \;
|
||||
artifacts:
|
||||
paths:
|
||||
- public
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
||||
```
|
||||
|
||||
## Push your Hugo website to GitLab
|
||||
|
||||
Next, create a new repository on GitLab. It is *not* necessary to make the repository public. In addition, you might want to add `/public` to your .gitignore file, as there is no need to push compiled assets to GitLab or keep your output website in version control.
|
||||
|
||||
```sh
|
||||
# initialize new git repository
|
||||
git init
|
||||
|
||||
# add /public directory to our .gitignore file
|
||||
echo "/public" >> .gitignore
|
||||
|
||||
# commit and push code to master branch
|
||||
git add .
|
||||
git commit -m "Initial commit"
|
||||
git remote add origin https://gitlab.com/YourUsername/your-hugo-site.git
|
||||
git push -u origin master
|
||||
```
|
||||
|
||||
## Wait for your page to build
|
||||
|
||||
That's it! You can now follow the CI agent building your page at `https://gitlab.com/<YourUsername>/<your-hugo-site>/pipelines`.
|
||||
|
||||
After the build has passed, your new website is available at `https://<YourUsername>.gitlab.io/<your-hugo-site>/`.
|
||||
|
||||
## Next steps
|
||||
|
||||
GitLab supports using custom CNAME's and TLS certificates. For more details on GitLab Pages, see the [GitLab Pages setup documentation](https://about.gitlab.com/2016/04/07/gitlab-pages-setup/).
|
||||
|
||||
[Quick Start]: /getting-started/quick-start/
|
86
docs/content/en/host-and-deploy/host-on-keycdn/index.md
Normal file
@@ -0,0 +1,86 @@
|
||||
---
|
||||
title: Host on KeyCDN
|
||||
description: Host your site on KeyCDN.
|
||||
categories: []
|
||||
keywords: []
|
||||
aliases: [/hosting-and-deployment/hosting-on-keycdn/]
|
||||
---
|
||||
|
||||
[KeyCDN](https://www.keycdn.com/) provides a multitude of features to help accelerate and secure your Hugo site globally including Brotli compression, Let's Encrypt support, Origin Shield, and more.
|
||||
|
||||
## Assumptions
|
||||
|
||||
- You already have a Hugo page configured
|
||||
- You have a GitLab account
|
||||
- You have a KeyCDN account
|
||||
|
||||
## Create a KeyCDN Pull Zone
|
||||
|
||||
The first step will be to log in to your KeyCDN account and create a new zone. Name this whatever you like and select the [Pull Zone](https://www.keycdn.com/support/create-a-pull-zone/) option. As for the origin URL, your site will be running on [GitLab Pages](https://docs.gitlab.com/ee/user/project/pages/getting_started_part_one.html) with a URL of `https://youruser.gitlab.io/reponame/`. Use this as the Origin URL.
|
||||
|
||||

|
||||
|
||||
While the origin location doesn't exist yet, you will need to use your new Zone URL address (or [Zone Alias](https://www.keycdn.com/support/create-a-zone-alias/)) in the `.gitlab-ci.yml` file that will be uploaded to your GitLab project.
|
||||
|
||||
Ensure that you use your Zone URL or Zone alias as the `BASEURL` variable in the example below. This will be the user-visible website address.
|
||||
|
||||
## Configure Your .gitlab-ci.yml File
|
||||
|
||||
Your `.gitlab-ci.yml` file should look similar to the example below. Be sure to modify any variables that are specific to your setup.
|
||||
|
||||
```yml
|
||||
image: alpine:latest
|
||||
|
||||
variables:
|
||||
BASEURL: "https://cipull-7bb7.kxcdn.com/"
|
||||
HUGO_VERSION: "0.26"
|
||||
HUGO_CHECKSUM: "67e4ba5ec2a02c8164b6846e30a17cc765b0165a5b183d5e480149baf54e1a50"
|
||||
KEYCDN_ZONE_ID: "75544"
|
||||
|
||||
before_script:
|
||||
- apk update
|
||||
- apk add curl
|
||||
|
||||
pages:
|
||||
stage: deploy
|
||||
script:
|
||||
- apk add git
|
||||
- git submodule update --init
|
||||
- curl -sSL https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.tar.gz -o /tmp/hugo.tar.gz
|
||||
- echo "${HUGO_CHECKSUM} /tmp/hugo.tar.gz" | sha256sum -c
|
||||
- tar xf /tmp/hugo.tar.gz hugo -C /tmp/ && cp /tmp/hugo /usr/bin
|
||||
- hugo --baseURL ${BASEURL}
|
||||
- curl "https://api.keycdn.com/zones/purge/${KEYCDN_ZONE_ID}.json" -u "${KEYCDN_API_KEY}:"
|
||||
artifacts:
|
||||
paths:
|
||||
- public
|
||||
only:
|
||||
- master
|
||||
```
|
||||
|
||||
Using this integration method, you will have to specify the Zone ID and your [KeyCDN API](https://www.keycdn.com/api) key as secret variables. To do this, navigate to the top-left menu bar in GitLab and select Projects. Then, select your project and click on the Settings page. Finally, select Pipelines from the sub-menu and scroll down to the Secret Variable section.
|
||||
|
||||
The Secret Variable for your Zone ID should look similar to:
|
||||
|
||||

|
||||
|
||||
While the Secret Variable for your API Key will look similar to:
|
||||
|
||||

|
||||
|
||||
While not strictly required, providing your Zone ID and API key is recommended for purging your zone. Without them, the CDN may continue serving outdated versions of your assets for an extended period.
|
||||
|
||||
## Push your changes to GitLab
|
||||
|
||||
Now it's time to push the newly created repository to GitLab:
|
||||
|
||||
```sh
|
||||
git remote add origin git@gitlab.com:youruser/ci-example.git
|
||||
git push -u origin master
|
||||
```
|
||||
|
||||
You can watch the progress and CI job output in your GitLab project under “Pipelines”.
|
||||
|
||||
After verifying your CI job ran without issues, first check that your GitLab page shows up under `https://youruser.gitlab.io/reponame/` (it might look broken depending on your browser settings as all links point to your KeyCDN zone---don't worry about that) and then by heading to whatever Zone alias / Zone URL you defined.
|
||||
|
||||
To learn more about Hugo hosting options with KeyCDN, check out the complete [Hugo hosting with KeyCDN integration guide](https://www.keycdn.com/support/hugo-hosting/).
|
After Width: | Height: | Size: 112 KiB |
After Width: | Height: | Size: 116 KiB |
After Width: | Height: | Size: 111 KiB |
143
docs/content/en/host-and-deploy/host-on-netlify/index.md
Normal file
@@ -0,0 +1,143 @@
|
||||
---
|
||||
title: Host on Netlify
|
||||
description: Host your site on Netlify.
|
||||
categories: []
|
||||
keywords: []
|
||||
aliases: [/hosting-and-deployment/hosting-on-netlify/]
|
||||
---
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Please complete the following tasks before continuing:
|
||||
|
||||
1. [Create a Netlify account]
|
||||
1. [Install Git]
|
||||
1. [Create a Hugo site] and test it locally with `hugo server`
|
||||
1. Commit the changes to your local repository
|
||||
1. 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.
|
||||
|
||||

|
||||
|
||||
### Step 3
|
||||
|
||||
Authorize Netlify to connect with your GitHub account by pressing the **Authorize Netlify** button.
|
||||
|
||||

|
||||
|
||||
### Step 4
|
||||
|
||||
Press the **Configure Netlify on GitHub** button.
|
||||
|
||||

|
||||
|
||||
### Step 5
|
||||
|
||||
Install the Netlify app by selecting your GitHub account.
|
||||
|
||||

|
||||
|
||||
### Step 6
|
||||
|
||||
Press the **Install** button.
|
||||
|
||||

|
||||
|
||||
### Step 7
|
||||
|
||||
Click on the site's repository from the list.
|
||||
|
||||

|
||||
|
||||
### Step 8
|
||||
|
||||
Set the site name and branch from which to deploy.
|
||||
|
||||

|
||||
|
||||
### Step 9
|
||||
|
||||
Define the build settings, press the **Add environment variables** button, then press the **New variable** button.
|
||||
|
||||

|
||||
|
||||
### 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
|
||||
|
||||

|
||||
|
||||
### Step 11
|
||||
|
||||
Press the "Deploy my new site" button at the bottom of the page.
|
||||
|
||||

|
||||
|
||||
### Step 12
|
||||
|
||||
At the bottom of the screen, wait for the deploy to complete, then click on the deploy log entry.
|
||||
|
||||

|
||||
|
||||
### Step 13
|
||||
|
||||
Press the **Open production deploy** button to view the live site.
|
||||
|
||||

|
||||
|
||||
## 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:
|
||||
|
||||
```toml {file="netlify.toml"}
|
||||
[build.environment]
|
||||
HUGO_VERSION = "0.144.2"
|
||||
NODE_VERSION = "22"
|
||||
TZ = "America/Los_Angeles"
|
||||
|
||||
[build]
|
||||
publish = "public"
|
||||
command = "hugo --gc --minify"
|
||||
```
|
||||
|
||||
If your site requires Dart Sass to transpile Sass to CSS, the configuration file should look something like this:
|
||||
|
||||
```toml {file="netlify.toml"}
|
||||
[build.environment]
|
||||
HUGO_VERSION = "0.144.2"
|
||||
DART_SASS_VERSION = "1.85.0"
|
||||
NODE_VERSION = "22"
|
||||
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 \
|
||||
"""
|
||||
```
|
After Width: | Height: | Size: 8.4 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 8.3 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 10 KiB |
78
docs/content/en/host-and-deploy/host-on-render.md
Normal file
@@ -0,0 +1,78 @@
|
||||
---
|
||||
title: Host on Render
|
||||
description: Host your on Render.
|
||||
categories: []
|
||||
keywords: []
|
||||
aliases: [/hosting-and-deployment/hosting-on-render/]
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
[Render](https://render.com) is a fully-managed cloud platform where you can host static sites, backend APIs, databases, cron jobs, and all your other apps in one place.
|
||||
|
||||
Static sites are **completely free** on Render and include the following:
|
||||
|
||||
- Continuous, automatic builds & deploys from [GitHub](https://render.com/docs/github) and [GitLab](https://render.com/docs/gitlab).
|
||||
- Automatic SSL certificates through [Let's Encrypt](https://letsencrypt.org).
|
||||
- Instant cache invalidation with a lightning fast, global CDN.
|
||||
- Unlimited collaborators.
|
||||
- Unlimited [custom domains](https://render.com/docs/custom-domains).
|
||||
- Automatic [Brotli compression](https://en.wikipedia.org/wiki/Brotli) for faster sites.
|
||||
- Native HTTP/2 support.
|
||||
- [Pull Request Previews](https://render.com/docs/pull-request-previews).
|
||||
- Automatic HTTP → HTTPS redirects.
|
||||
- Custom URL redirects and rewrites.
|
||||
|
||||
## Assumptions
|
||||
|
||||
- You have an account with GitHub or GitLab.
|
||||
- You have completed the [Quick Start] or have a Hugo website you are ready to deploy and share with the world.
|
||||
- You have a Render account. You can sign up at https://render.com/register.
|
||||
|
||||
## Deployment
|
||||
|
||||
You can set up a Hugo site on Render in two quick steps:
|
||||
|
||||
1. Create a new **Static Site** on Render, and give Render permission to access your GitHub/GitLab repo.
|
||||
1. Use the following values during creation:
|
||||
|
||||
Field | Value
|
||||
------------------- | -------------------
|
||||
**Build Command** | `hugo --gc --minify` (or your own build command)
|
||||
**Publish Directory** | `public` (or your own output directory)
|
||||
|
||||
That's it! Your site will be live on your Render URL (which looks like `yoursite.onrender.com`) as soon as the build is done.
|
||||
|
||||
## Continuous deploys
|
||||
|
||||
Now that Render is connected to your repo, it will **automatically build and publish your site** any time you push to your GitHub/GitLab.
|
||||
|
||||
You can choose to disable auto deploys under the **Settings** section for your site and deploy it manually from the Render dashboard.
|
||||
|
||||
## CDN and cache invalidation
|
||||
|
||||
Render hosts your site on a global, lightning fast CDN which ensures the fastest possible download times for all your users across the globe.
|
||||
|
||||
Every deploy automatically and instantly invalidates the CDN cache, so your users can always access the latest content on your site.
|
||||
|
||||
## Custom domains
|
||||
|
||||
Add your own domains to your site easily using Render's [custom domains](https://render.com/docs/custom-domains) guide.
|
||||
|
||||
## Pull Request previews
|
||||
|
||||
With Pull Request (PR) previews, you can visualize changes introduced in a pull request instead of simply relying on code reviews.
|
||||
|
||||
Once enabled, every PR for your site will automatically generate a new static site based on the code in the PR. It will have its own URL, and it will be deleted automatically when the PR is closed.
|
||||
|
||||
Read more about [Pull Request Previews](https://render.com/docs/pull-request-previews) on Render.
|
||||
|
||||
## Hugo themes
|
||||
|
||||
Render automatically downloads all Git submodules defined in your Git repo on every build. This way Hugo themes added as submodules work as expected.
|
||||
|
||||
## Support
|
||||
|
||||
Chat with Render developers at https://render.com/chat or email `support@render.com` if you need help.
|
||||
|
||||
[Quick Start]: /getting-started/quick-start/
|
94
docs/content/en/host-and-deploy/host-on-sourcehut-pages.md
Normal file
@@ -0,0 +1,94 @@
|
||||
---
|
||||
title: Host on SourceHut Pages
|
||||
description: Host your site on SourceHut Pages.
|
||||
categories: []
|
||||
keywords: []
|
||||
aliases: [/hosting-and-deployment/hosting-on-sourcehut/]
|
||||
---
|
||||
|
||||
## Assumptions
|
||||
|
||||
- Working familiarity with [Git] or [Mercurial] for version control
|
||||
- Completion of the Hugo [Quick Start]
|
||||
- A [SourceHut account]
|
||||
- A Hugo website on your local machine that you are ready to publish
|
||||
|
||||
[Git]: https://git-scm.com/
|
||||
[Mercurial]: https://www.mercurial-scm.org/
|
||||
[SourceHut account]: https://meta.sr.ht/login
|
||||
[Quick Start]: /getting-started/quick-start/
|
||||
|
||||
Any and all mentions of `<YourUsername>` refer to your actual SourceHut username and must be substituted accordingly.
|
||||
|
||||
## BaseURL
|
||||
|
||||
The [`baseURL`] in your site configuration must reflect the full URL provided by SourceHut Pages if you are using the default address (e.g. `https://<YourUsername>.srht.site/`). If you want to use another domain, check the [custom domain section] of the official documentation.
|
||||
|
||||
[`baseURL`]: /configuration/all/#baseurl
|
||||
[custom domain section]: https://srht.site/custom-domains
|
||||
|
||||
## Manual deployment
|
||||
|
||||
This method does not require a paid account. To proceed you will need to create a [SourceHut personal access token] and install and configure the [hut]CLI tool:
|
||||
|
||||
[SourceHut personal access token]: https://meta.sr.ht/oauth2/personal-token/
|
||||
[hut]: https://sr.ht/~xenrox/hut/
|
||||
|
||||
```sh
|
||||
hugo
|
||||
tar -C public -cvz . > site.tar.gz
|
||||
hut init
|
||||
hut pages publish -d <YourUsername>.srht.site site.tar.gz
|
||||
```
|
||||
|
||||
A TLS certificate will be automatically obtained for you, and your new website will be available at `https://<YourUsername>.srht.site/` (or the provided custom domain).
|
||||
|
||||
## Automated deployment
|
||||
|
||||
This method requires a paid account and relies on the SourceHut build system.
|
||||
|
||||
First, define your [build manifest] by creating a `.build.yml` file in the root of your project. The following is a bare-bones template:
|
||||
|
||||
[build manifest]: https://man.sr.ht/builds.sr.ht/#build-manifests
|
||||
|
||||
```yaml {file=".build.yml" copy=true}
|
||||
image: alpine/edge
|
||||
packages:
|
||||
- hugo
|
||||
- hut
|
||||
oauth: pages.sr.ht/PAGES:RW
|
||||
environment:
|
||||
site: <YourUsername>.srht.site
|
||||
tasks:
|
||||
- package: |
|
||||
cd $site
|
||||
hugo
|
||||
tar -C public -cvz . > ../site.tar.gz
|
||||
- upload: |
|
||||
hut pages publish -d $site site.tar.gz
|
||||
```
|
||||
|
||||
Now what's left is creating a repository titled `<YourUsername>.srht.site` (or your custom domain, if applicable) and pushing your local project. Here's an example using Git:
|
||||
|
||||
```sh
|
||||
# initialize new git repository
|
||||
git init
|
||||
|
||||
# add /public directory to our .gitignore file
|
||||
echo "/public" >> .gitignore
|
||||
|
||||
# commit and push code to main branch
|
||||
git add .
|
||||
git commit -m "Initial commit"
|
||||
git remote add origin https://git.sr.ht/~<YourUsername>/<YourUsername>.srht.site
|
||||
git push -u origin main
|
||||
```
|
||||
|
||||
You can now follow the build progress of your page at `https://builds.sr.ht/`.
|
||||
|
||||
After the build has passed, a TLS certificate will be automatically obtained for you and your new website will be available at `https://<YourUsername>.srht.site/` (or the provided custom domain).
|
||||
|
||||
## Other resources
|
||||
|
||||
- [SourceHut Pages](https://srht.site/)
|
||||
- [SourceHut Builds user manual](https://man.sr.ht/builds.sr.ht/)
|