How to build a private blog


1 Software install

1.1 Nodejs,click here to download
1.2 Git,click here to download

2 Construct

2.1 Run in “Git”

Check the version for node and npm

$ hexo node -v
$ hexo npm -v
$ npm install # 切换到自己博客的目录下并执行

2.2 Install the “cnpm” and “hexo-cli”

$ npm install -g cnpm --registry=http://registry.npm.taobao.org
$ hexo cnpm -v
$ cnpm install -g hexo-cli
$ hexo -v

2.3 constract a local service for “Myblog”

To construct and start a “Myblog”

$ mkdir Myblog
$ cd Myblog
$ hexo init #初始化自己的博客
$ hexo s # 运行自己的博客

Check “Myblog” in browser with the below address

$ http://localhost:4000/ #可以直接在浏览器中打开刚刚的博客

Write a article

$ hexo n filename

To update the content for “Myblog”

$ hexo clean
$ hexo g
$ hexo s

###2.4 Create a blog home based on Github

Fist,Create a new respository “YourGithubName.github.io”

Second, install a “git” plugin

$ cnpm install --save hexo-deployer-git # 必须要安装该插件才可以部署到github

Third, Configure the file “config.yml” in your dir for Myblog as followings

Deployment

Docs: https://hexo.io/docs/deployment.html

deploy:
type: git
repo: https://github.com/YourGithubName/YourGithubName.github.io.git
branch: master
Fourth, if your PC is Win10,you should execute these codes

$ cnpm install --save hexo-deployer-git # install deployer for uploading
$ git config --global user.email xxx
$ git config --global user.name xxx
$ hexo d

3 beautify your blog layout

$ git clone https://github.com/litten/hexo-theme-yilia.git themes/yilia
$ hexo c
$ hexo g
$ hexo d

Note: you should modify the file “config.yml” as below:

theme: yilia


文章作者: chaoyuny
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 chaoyuny !
  目录