Hexo provides a fast and easy deployment strategy. You only need one single command to deploy your site to your server.
$ hexo deploy |
Install the necessary plugin(s) that is compatible with the deployment method provided by your server/repository.
Deployment is usually configured through _config.yml. A valid configuration must have the type
field. For example:
deploy: |
You can use multiple deployers. Hexo will execute each deployer in order.
deploy: |
Refer to the Plugins list for more deployment plugins.
Git
- Install hexo-deployer-git.
$ npm install hexo-deployer-git --save |
- Edit _config.yml (with example values shown below as comments):
deploy: |
Option | Description | Default |
---|---|---|
repo |
URL of the target repository | |
branch |
Branch name. | gh-pages (GitHub)coding-pages (Coding.net)master (others) |
message |
Customize commit message. | Site updated: {{ now('YYYY-MM-DD HH:mm:ss') }} |
token |
Optional token value to authenticate with the repo. Prefix with $ to read token from environment variable |
- Deploy your site
hexo clean && hexo deploy
.
- You will be prompted with username and password of the target repository, unless you authenticate with a token or ssh key.
- hexo-deployer-git does not store your username and password. Use git-credential-cache to store them temporarily.
- Navigate to your repository settings and change the “Pages” branch to
gh-pages
(or the branch specified in your config). The deployed site should be live on the link shown on the “Pages” setting.
Heroku
Install hexo-deployer-heroku.
$ npm install hexo-deployer-heroku --save |
Edit settings.
deploy: |
Option | Description |
---|---|
repo , repository |
Heroku repository URL |
message |
Customize commit message (Default to Site updated: {{ now('YYYY-MM-DD HH:mm:ss') }} ) |
Netlify
Netlify provides continuous deployment (Git-triggered builds), an intelligent global CDN, full DNS (including custom domains), automated HTTPS, asset acceleration, and a lot more. It is a unified platform that automates your code to create high-performance, easily maintainable sites and web apps.
There are two different ways to deploy your sites on Netlify. The most common way is to use the web UI. Go to the create a new site page, select your project repo from GitHub, GitLab, or Bitbucket, and follow the prompts.
Alternatively, you can use Netlify’s Node based CLI tool to manage and deploy sites on Netlify without leaving your terminal.
You can also add a Deploy to Netlify Button in your README.file to allow others to create a copy of your repository and be deployed to Netlify via one click.
Rsync
Install hexo-deployer-rsync.
$ npm install hexo-deployer-rsync --save |
Edit settings.
deploy: |
Option | Description | Default |
---|---|---|
host |
Address of remote host | |
user |
Username | |
root |
Root directory of remote host | |
port |
Port | 22 |
delete |
Delete old files on remote host | true |
verbose |
Display verbose messages | true |
ignore_errors |
Ignore errors | false |
OpenShift
hexo-deployer-openshift
has been deprecated in 2022.
Install hexo-deployer-openshift.
$ npm install hexo-deployer-openshift --save |
Edit settings.
deploy: |
Option | Description |
---|---|
repo |
OpenShift repository URL |
message |
Customize commit message (Default to Site updated: {{ now('YYYY-MM-DD HH:mm:ss') }} ) |
FTPSync
Install hexo-deployer-ftpsync.
$ npm install hexo-deployer-ftpsync --save |
Edit settings.
deploy: |
Option | Description | Default |
---|---|---|
host |
Address of remote host | |
user |
Username | |
pass |
Password | |
remote |
Root directory of remote host | / |
port |
Port | 21 |
clear |
Remove all files and directories from the remote directory before upload | false |
verbose |
Display verbose messages | false |
SFTP
Install hexo-deployer-sftp. Deploys the site via SFTP, allowing for passwordless connections using ssh-agent.
$ npm install hexo-deployer-sftp --save |
Edit settings.
deploy: |
Option | Description | Default |
---|---|---|
host |
Address of remote host | |
port |
Port | 22 |
user |
Username | |
pass |
Password | |
privateKey |
Path to a ssh private key | |
passphrase |
Optional passphrase for the private key | |
agent |
Path to the ssh-agent socket | $SSH_AUTH_SOCK |
remotePath |
Root directory of remote host | / |
forceUpload |
Override existing files | false |
concurrency |
Max number of SFTP tasks processed concurrently | 100 |
Vercel
Vercel is a cloud platform that enables developers to host Jamstack websites and web services that deploy instantly, scale automatically, and require no supervision, all with zero configuration. They provide a global edge network, SSL encryption, asset compression, cache invalidation, and more.
Step 1: Add a build script to your package.json
file:
{ |
Step 2: Deploy your Hexo Website to Vercel
To deploy your Hexo app with a Vercel for Git Integration, make sure it has been pushed to a Git repository.
Import the project into Vercel using the Import Flow. During the import, you will find all relevant options preconfigured for you; however, you can choose to change any of these options, a list of which can be found here.
After your project has been imported, all subsequent pushes to branches will generate Preview Deployments, and all changes made to the Production Branch (commonly “main”) will result in a Production Deployment.
Alternatively, you can click the deploy button below to create a new project:
Bip
Bip is a commercial hosting service that provides zero downtime deployment, a global CDN, SSL, unlimited bandwidth and more for static websites. Plans are available on a pay as you go, per domain basis.
Getting started is quick and easy, as Bip provides out the box support for Hexo. This guide assumes you already have a Bip domain and Bip CLI installed.
1: Initialise your project directory
$ bip init |
Follow the prompts, where you’ll be asked which domain you’d like to deploy to. Bip will detect that you’re using Hexo, and set project settings like the source file directory automatically.
2: Deploy your website
$ hexo generate —deploy && bip deploy |
After a few moments, your website will be deployed.
RSS3
hexo-deployer-rss3
has been deprecated in 2023.
RSS3 is an open protocol designed for content and social networks in the Web 3.0 era.
Install hexo-deployer-rss3.
Modify the configuration.
deploy: # The root configuration block for all deployers |
Parameters | Description |
---|---|
endpoint |
a link to the RSS3 Hub |
privateKey |
your private key, 64 bytes |
ipfs/deploy |
whether to deploy to IPFS |
ipfs/gateway |
IPFS API gateway |
ipfs/api/key |
IPFS gateway-related authentication content |
ipfs/api/secret |
IPFS gateway-related authentication content |
generate static files
deploy
For deployment-related considerations, you can refer to Our documentation.
Edgio (formerly Layer0)
Edgio (formerly Layer0) is an Internet-scale platform that makes it easy for teams to build, release, protect, and accelerate their web apps and APIs.
- In your hexo project directory, install the Edgio CLI:
npm i -g @edgio/cli |
- Install Hexo connector by Edgio:
edgio init --connector=@edgio/hexo |
- Deploy
edgio deploy |
Alternatively, you can click the deploy button below to create a new project:
Other Methods
All generated files are saved in the public
folder. You can copy them to wherever you like.