Hexo

Prepare - installation

  1. Node.js
  2. Git
  3. install Hexo
    $ npm install -g hexo-cli

Set up a new blog

1
2
3
$ hexo init blog
$ cd blog
$ npm install

Start a local sever

run $ hexo server
server for drafts

  1. install plug-in
    $npm install hexo-browsersync –save
    $hexo server - -draft - -open
    now my blog is hot reload at http://localhost:4000/

Deploy my blog to Github

  1. Create a new repository
    Repostoryname: ownername.github.io
    e.g JinWangQ.github.io

  2. Edit _config.yml

    1
    2
    3
    4
    5
    6
    # Deployment
    ## Docs: https://hexo.io/docs/deployment.html
    deploy:
    type: git
    repository: https://github.com/JinWangQ/JinWangQ.github.io.git
    branch: master
  3. Install hexo-deployer-git
    $ npm install hexo-deployer-git --save

  4. Upload your site
    $ hexo deploy
    now http://jinwangq.github.io is available

Write a new post (what i am now doing ;D)

  • Create a new post
    $ hexo new "my first post"
  • Edit source/_posts/My-first-post
    Markdown supported
  • Multiple tags
    tags: [tag1,tag2,tag3]

Delete a post

  1. Delete the post from source/_post folder
  2. Run $ hexo clean
  3. Run $ hexo generate
  4. Run $ hexo deploy

Problems solving

  1. Works well locally no style sheet after upload

    • clear browsers cache
      firefox
      Preferences -> Privacy & Security -> Cookies and Site Data -> clear data
      chrome
      chrome://settings/clearBrowserData
    • Deploy once again

      1
      2
      3
      $ hexo clean
      $ hexo g
      $ hexo d

Reference

  1. Hexo
  2. Hexo搭建博客教程 by nMask