美文网首页
hexo搭建部署

hexo搭建部署

作者: GALAXY_ZMY | 来源:发表于2016-07-10 21:40 被阅读30次

跟一个同学闲聊时无意中了解了hexo,它是一款基于Node.js的静态博客框架.

环境搭建

基于ubuntu14.10

1. 安装node.js

用来生成静态页面的

2.安装git

用来把本地的hexo内容提交到github上去

3.申请GitHub

用来做博客的远程创库、域名、服务器之类的

4.安装HEXO
sudo npm install -g hexo
5.初始化

执行init命令初始化hexo到你指定的目录, 比如我在本地home中新建了一个hexo文件夹, 然后cd hexo

执行

hexo init 

这样就完成了安装,确实很简单

6.生成静态页面

在我刚才创建的hexo目录下,执行如下命令,生成静态页面至hexo\public\目录。

hexo generate (或者简写 hexo g )
7.本地启动
hexo server 

然后在浏览器中输入 http://localhost:4000 (我的页面能正常显示)

8.配置github

首先在github上创建一个新的仓库,仓库名叫your_user_name.github.io,然后与本地建立关联.

在刚才创建的文件夹hexo下的_config.yml文件

vim _config.yml

将最下面的

deploy: 
  type: 

修改为

deploy: 
  type: git 
  repository: https://github.com/willlims/willlims.github.io.git
  branch: master

我的github名为willlims,将https://github.com/willlims/willlims.github.io.git中的willlims改成你的github名就ok了.

9.执行如下命令实现git部署(可以理解成保存刚才的配置)
npm install hexo-deployer-git --save

然后,执行配置命令

hexo deploy

然后再浏览器中输入https://your_git_name.github.io就行了,我的github的账户叫willlims,所以地址是https://willlims.github.io, 把your_git_name这个改成你github的账户名就行了.

这是将我的这篇文章原文用hexo展示的效果,https://willlims.github.io/2016/07/10/hello-world/ , 整体感觉效果很好

相关文章

网友评论

      本文标题:hexo搭建部署

      本文链接:https://www.haomeiwen.com/subject/covdjttx.html