Skip to content
Hexo

Deploy a Hexo website

Hexo is a fast, simple and powerful blog framework that allows you to create static websites with ease.

Requirements

If you need example source code, initialize a Hexo project with the Cactus theme, Git and Node.js:

npx hexo init myStaticApp --no-install

Deploy a static application

You can create an application in our Console or through Clever Tools. Install them with npm or any supported package manager:

# Install with npm or any supported method
npm i -g clever-tools

# Login to Clever Cloud and check it worked
clever login
clever profile

Go to the folder where you want to create your application, initialize a Git repository and create the linked application:

cd myStaticApp
git init
clever create -t static

To deploy on Clever Cloud, your local folder needs to be an initialized Git repository linked to an application. If you already have an application on Clever Cloud and want to link it to the current local folder:

clever link your_app_name_or_ID

Import the theme as a submodule:

git submodule add https://github.com/probberechts/hexo-theme-cactus.git themes/cactus

Environment variables

Configure the output directory and build commands:

clever env set CC_WEBROOT "/public"
clever env set CC_PRE_BUILD_HOOK "npm install"
clever env set CC_BUILD_COMMAND "npm run build"

Push your code

Once you complete these steps, commit your content to the local repository and deploy it:

git add .
git commit -m "First deploy"

clever deploy
clever open

You can display your website’s URL or add a custom domain to it (you’ll need to configure DNS):

clever domain
clever domain add your.website.tld

404 page location

If you need to use a specific page for 404 errors, define its location with the SERVER_ERROR_PAGE_404 environment variable from Static Web Server, used by default in the Static runtime. For example: SERVER_ERROR_PAGE_404=404.html.

🎓 Learn more

Last updated on