How to setup Hexo for blogging

  • Install Node and npm for windows.

    1
    2
    3
    4
    5
    C:\Users\unshakeable>node -v
    v6.9.5
    C:\Users\unshakeable>npm -v
    3.10.10
  • Install hexo-cli

    1
    C:\Users\unshakeable>npm install hexo-cli -g
  • Check if hexo-cli is installed properly

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    C:\Users\unshakeable>hexo -v
    hexo-cli: 1.0.2
    os: Windows_NT 6.1.7601 win32 x64
    http_parser: 2.7.0
    node: 6.9.5
    v8: 5.1.281.89
    uv: 1.9.1
    zlib: 1.2.8
    ares: 1.10.1-DEV
    icu: 57.1
    modules: 48
    openssl: 1.0.2k
  • Create “My Blog” directory and CD to it and initiate blog:

    1
    2
    3
    C:\Users\unshakeable>mkdir "My Blog"
    C:\Users\unshakeable>cd "My Blog"
    C:\Users\unshakeable\My Blog>hexo init
  • Start Hexo server

    1
    C:\Users\unshakeable>hexo server
  • Check Hexo default blog page

    1
    http://localhost:4000/
  • Create new post

    1
    C:\Users\unshakeable>hexo new post <post-title>
  • Publish blog

    1
    C:\Users\unshakeable>hexo generate
  • A public folder will be generated with static site.

  • Publish this folder to github.io

Important directories and files:

  • Templates for draft, page & post:

    1
    2
    3
    4
    C:\Users\unshakeable\My Blog>\scaffolds
    - draft.md
    - page.md
    - post.md
  • User posts directory:

    1
    2
    C:\Users\unshakeable\My Blog>\source\_posts
    - hello-world.md
  • Main config file for Hexo blog:

    1
    2
    C:\Users\unshakeable\My Blog>\
    - _config.yml
  • Node modules for Hexo:

    1
    C:\Users\unshakeable\My Blog>\node_modules
  • Default theme for Hexo:

    1
    C:\Users\unshakeable\My Blog>\themes\landscape

Customization

  • Update Banner photo
    “C:\Users\unshakeable\My Blog\themes\landscape\source\css\images\banner.jpg”

  • Update background-size from “cover” to “55%”
    C:\Users\unshakeable\My Blog\themes\landscape\source\css_partial\header.styl

  • Update blog’s main config file: C:\Users\unshakeable\My Blog>_config.yml

    1
    2
    3
    4
    5
    6
    7
    # Site
    title: Unshakeable
    subtitle: Life Lessons
    description:
    author: Mr. Unshakeable
    language: English
    timezone: EST