Hello Blog!

Github&HEXO

一直在本地记录一些东西,想想还是弄个Blog吧。

记录一些方法步骤,偶尔也记点心得体会。

也不需要google和baidu索引到,github+hexo足矣。

Github pages

githubPages

Create a repo named userName.github.io in github, then visit the blog use userName.github.io.

Hexo

Install

$ brew install node
$ npm install hexo-cli -g
$ hexo init Blog
$ cd Blog
$ npm install
$ hexo server -p 5000

Config

  • config plugin

      $ npm install <plugin-name> --save
      $ npm update
    
  • config theme

      $ git clone <repository> themes/<theme-name>
    
    _config.yml
    1
    theme: <theme-name>

    Some beauty themes: next, yilia, typing, solar

  • deploy with Github

      $ npm install hexo-deployer-git --save
    
    _config.yml
    1
    2
    3
    4
    deploy:
    type: git
    repo: git@github.com:Lincoln12w/lincoln12w.github.io.git
    branch: master

Write a blog

$ hexo new post <post_name>

or put the written markdown in directory Blog/source/_post/.

Extension config

Insert local image

  • config

      $ npm install hexo-asset-image
    
    _config.yml
    1
    post_asset_folder: true
  • usage

    post_name.md
    1
    ![image_name](post_name/image_name.jpg)

reference: 在 hexo 中无痛使用本地图片

Render Latex Math with Mathjax

  • config

      $ npm uninstall hexo-renderer-marked --save
      $ npm install hexo-renderer-markdown-it-plus --save
    
  • usage

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    ---
    title: ***
    date: ***
    tags: ***
    mathjax: true
    ---
    <link href="https://cdn.bootcss.com/KaTeX/0.7.1/katex.min.css" rel="stylesheet">
    ****

reference: 如何在Hexo中使用Mathjax渲染LaTeX数学公式

set disqus comment

reference: Github 搭建 hexo (四)——更换主题,disqus,RSS

Issues

When execute hexo d, the Permission denied situation occurred.

git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

The solution is:

1
2
ssh-add ~/.ssh/xxxx_rsa
ssh -T git@github.com