Hexo blog set up under w10 environment

w10 use hexo + github hands to build his first blog

For a programmer, the importance blog is self-evident, not only the accumulation of knowledge, but also to better share their experiences to others. Today to more popular nowadays hexo blog set up their own blog. hexo is nodejs wrote a popular blog-based framework. It is a fast, simple and efficient framework blog. Hexo use Markdown (or other rendering engine) analytical articles. Easy to learn.

A ready


  • Download node.js
    1. nodejs.org to download.
    After downloading directly installed



    2. Verify Nodejs installation show this step would prove successful installation installation nodejs

    PS C:\WINDOWS\system32> node -v
    v10.16.3
    PS C:\WINDOWS\system32>



  • Taobao mirror installation


Enter the following command in the terminal (or administrator privileges)


PS C:\WINDOWS\system32> npm install -g cnpm --registry=https://registry.npm.taobao.org

The purpose is to install a download mirror hexo end faster.

Mirroring cnpm two mounting of hexo



1. Use the following command:

PS C:\WINDOWS\system32> cnpm install -g hexo-cli


Display hexo successful installation

2. Verify that the installation was successful hexo:

3. When using cnpm installation hexo, the following error may occur


solution:



Use cnpm installation hexo again to normal. .

Three initialization hexo blog



1. Create a new folder blog
PS C:\WINDOWS\system32> mkdir blog/

2. Initialize hexo:
PS C:\WINDOWS\system32\blog> hexo init

3. Check the blog folder, the contents are initialized blog in this folder, including style, style, and so on.

Here may sometimes appear Suman hexo not successful initialization of the phenomenon, the solution is to delete the blog document price, re-download.


Four local start blog



1. Use the following command to start a local blog:


PS C:\WINDOWS\system32\blog>hexo s

2. Start a successful, local access to the browser

Browser starts successfully, build a blog has been set up initially completed, the system automatically generates a hello World article, which describes the various commands hexo.



Five blog will be deployed to the far end, where the use github for remote deployment


Premise deployment is to have a github account and have some understanding of git.

1. Log on github, a new warehouse, pay attention to the new warehouse name must conform to the naming rules:

必须使用自己的昵称+github.io为自己的仓库名。否则找不到你的主页





2.安装git插件


PS C:\WINDOWS\system32\blog> cnpm install --save hexo-deployer-git

3.配置blog 文件夹下的_config.yml文件的最下面配置如下信息:

deploy:
type: git
repo: https://github.com/chentang99/chentang99.github.io.git 就是github新建仓库的地址

branch: master


4.使用命令将本地的博客推到远端。


PS C:\WINDOWS\system32\blog> hexo d

刷新自己的github仓库。显示多了很多的内容,那就是你博客的内容。

5.激动人心的时刻,就是公网访问你的网站,chengtang99.github.io
这里的访问名就是你的github仓库的名字

如果你想自定义的主题,github上有很多的模板,这里推荐一款比较流行和轻量级的主题:

点击访问yilia主题

六 常见的错误及解决



1.一定要在管理员的权限下部署博客

2.如果gitclone太慢的话。一个可能是网速,一个就是git的代理没有设置。如下建议。可以在hosts的系统文件中做如下的配置:

151.101.72.249 http://global-ssl.fastly.Net
192.30.253.112 http://github.com

3.hexo博客的初始化和操作都是在blog这个文件夹下操作的,如果有错误不能解决的话,可以删除这个文件,重新下载。后期也可以自定义自己的主题。具体的主题很多,可以在github上找到。

4.如果配置完github之后,在公网上访问自己的网站显示你找不到网页,那可能是你的仓库名和你的github的账号的昵称不相同,重新修改仓库名。

技术连接你我。分享共同进步。欢迎访问我的博客changtang
一起交流。

Guess you like

Origin www.cnblogs.com/chentang/p/11809221.html