Deploying Hexo Sites to Github Pages

Hexo is a great way to easily generate content and publish it use Github pages.

See my previous articles on setting up Hexo and creating content

Configuring your site name

Its important to add the URL of your github pages site to the Hexo configuraiton

_config.yml
1
2
3
4
# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: http://jr0cket.github.io/hexo-blog-test
root: /hexo-blog-test/

If your project uses a sub-folder, Make sure that the root line has a trailing forward slash, otherwise your URL paths will not be correct.

Projects use a sub-folder if they are deployed to the gh-pages branch of a repo. When you are using the main repo for a user or org (username.github.io or org-name.github.io) then these repos run the Github pages from the master branch, so no root should be required (except for a single forward slash which is set by default in hexo)

Example

1
root: /hexo-blog-test

This will give /hexo-blog-test2014-name-of-blog-post and wont show the page up or if it does then probably wont include the CSS styles


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