Move Hexo to Hugo

Apr. 24, 2020

Hugo in TravisCI

What is Hugo?

Hugo is a static site generator written in Go. It is optimized for speed, easy use and configurability. Hugo takes a directory with content and templates and renders them into a full html website. Hugo makes use of markdown files with front matter for meta data.

Hexo vs Hugo

Hexo is also fast and simple, it is a static blog generator, and Hugo is more like for a site not only blog. Hexo is written in Node.js. Since I am a Golang developer now. I think it is good to move to Hugo.

Prepare Hugo

Check the Hugo official page Migrate to Hugo before you do it by yourself.

Hugo has different content structure than Hexo.

First of all, remove any unrelated files like themes, submodules, hexo config file…

for removing submodules from

# Remove the submodule entry from .git/config
git submodule deinit -f path/to/submodule

# Remove the submodule directory from the superproject's .git/modules directory
rm -rf .git/modules/path/to/submodule

# Remove the entry in .gitmodules and remove the submodule directory located at path/to/submodule
git rm -f path/to/submodule

Then, Install Hugo and run hugo new site --force in the current folder, it will generate the mandatory files for the site.

Add theme you like and do configuration.

Move all posts to the new content folder, I put mine into the content/posts. Update the front matter of the posts to avoid compile error in the Hugo.

That’s almost done, it is easy because I moved my site from Jekyll to Hexo, then to Hugo, they all use markdown files and front matter for the post.

Continuous Delivery (CD)

I switched from Github to Firebase hosting after I moved from Jekyll to Hexo. Firebase hosting will give you a free SSL.


I use Travis CI to build pages and deploy to Firebase hosting. You can check mine .travis.yml  file.

Firebase hosting

You need a token to deploy to Firebase hosting from ci, following the doc Firebase CLI reference. Then Add the token to Travis CI .


So now, once TravisCI detects your master branch of repository has been changed, it will trigger the build in TravisCI, and build the static site and publish to firebase hosting.