Skip to content

Instantly share code, notes, and snippets.

Created May 26, 2016 09:41
Star You must be signed in to star a gist
What would you like to do?
How to use Hexo and deploy to GitHub Pages

How to use Hexo and deploy to GitHub Pages

1. Install Hexo

$ sudo npm install -g hexo-cli

$ hexo -v
hexo-cli: 0.1.9
os: Darwin 14.3.0 darwin x64
http_parser: 2.3
node: 0.12.7
uv: 1.6.1
zlib: 1.2.8
modules: 14
openssl: 1.0.1p

2. Create a project for your GitHub Pages

$ hexo init
INFO  Copying data to ~/***/
INFO  You are almost done! Don't forget to run 'npm install' before you start blogging with Hexo!

$ cd

$ npm install

3. Run a test server for your page on Mac

$ hexo server
INFO  Hexo is running at Press Ctrl+C to stop.

4. Set information for your new blog

$ vi _config.yml

~~~~~~~~~~~~~~~~~~ _config.yml ~~~~~~~~~~~~~~~~~~
# Site
title: yt8yt's note
description: yt8yt's personal blog
author: yt8yt
timezone: Japan

## If your site is put in a subdirectory, set url as '' and root as '/child/'
root: /
permalink: :year/:month/:day/:title/

5. Set information to use Git

$ npm install hexo-deployer-git --save
$ vi _config.yml

~~~~~~~~~~~~~~~~~~ _config.yml ~~~~~~~~~~~~~~~~~~
# Deployment
## Docs:
  type: git
  branch: master

6. Set "watch" before starting your work

"watch" command can monitor your files.

$ hexo generate --watch

7. Create a new post file

$ hexo new first-post
INFO  Created: ~/***/

8. Edit the above file with Markdown or Hexo's Helper

Hexo's Helper
I use Atom with "shift + control + m" when I use Markdown :-)

9. Delete "source/_posts/"

It's not necessary to deploy.

10. Deploy your new blog!!

$ hexo clean
$ hexo deploy

After writting the above command, you can see your new blog on GitHub Pages.

11. Change your blog theme

For instance, How to use the following theme.

## Install it
$ cd
$ git clone git:// themes/light

## Update the above files
$ themes/light
$ git pull

## Set information to use the theme
$ cd
$ vi _config.yml

~~~~~~~~~~~~~~~~~~ _config.yml ~~~~~~~~~~~~~~~~~~
# Extensions
## Plugins:
## Themes:
theme: light

12. Create a new page file

$ hexo new page aboutme
INFO  Created: ~/***/

$ cd source/aboutme/

$ vi

13. Use "Read More"

Write <!-- more --> in your articles.

14. Use Plugins

Copy link

Thanks to share!! 🤙

Copy link

alifma commented Jul 8, 2023

Still works on July 2023, thanks mate!

Copy link


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment