Generate and Deploy Your Hexo Website

To have your website available on the Internet, you need to generate the content and deploy it to your chosen service. You can deploy your site to a webserver such as apache, an Amazon S3 bucket, Heroku or Github Pages.

If you used the hexo server command previously you should note that this does not generate the HTML files for your website.

Generating your content

As all your content has been written in markdown, you need to generate the HTML files for your site. Hexo has a generator that does this for you. Inside your Hexo website project, run the command:

hexo generate

This creates all the HTML, CSS and JavaScript files and places them into the public directory. You can copy these files manually, or configure Hexo to deploy the site for you.

Deploying your hexo website site

As hexo is designed only a a site generator, you need a server to run your website on. You can run it on your own web server, a hosted web server or use a Cloud service like Github Pages.

As I am using Git to manage my hexo project, it makes sense to use Github pages to host my website. Github pages is really easy to use and performs very well.

Deployment on Github pages

Github pages is the easiest service I have found to deploy my Hexo websites on.

## Docs:
type: github
branch: master

I am using two-factor authorisation with Git which seems to cause an authentication problem. To fix this I run hexo deploy to create the .deploy directory and put its contents under Git version control. Then I change into the .deploy directory and do a manual push to Github with the command git push github master. From then on hexo deploy works correctly.

Using a custom Domain

To use a custom domain for your Hexo website, eg instead of, then you need to add a file called CNAME to the hexo project source directory


You will need to own this custom domain and set your domain to point to the actual web address. In the case of Github pages the web address would be

I created the above CNAME file and pointed my domain to

Back to Hexo overview | Next: Customising Hexo themes

This work is licensed under a Creative Commons Attribution 4.0 ShareAlike License, including custom images & stylesheets. Permissions beyond the scope of this license may be available at @jr0cket
Creative Commons License