how to deploy page on hexo

环境准备

安装node.js

安装hexo

在合适的位置新建Blog文件夹,进入Blog,使用git bash here打开命令提示窗口,输入

npm install hexo-cli -g

利用Hexo搭建一个博客

创建博客目录xxx.github.io 为了方便xxx设置为github帐号的名称

hexo init xxx.github.io
cd xxx.github.io
npm install

生成静态页面并展示

hexo clean
hexo g # g = generate
hexo s # s = server

然后打开浏览器,输入地址localhost:4000,即可看到效果

新建一篇文章

hexo new test # test即新建文章的名称

此时会在source/_posts目录下生成test.md文件,输入些许内容,保存
在source/_posts/下新建一个xxx.md文件也可

hexo clean
hexo g # g = generate
hexo s # s = server

访问localhost:4000

配置

网站的设置大部分都在_config.yml文件中,详细配置可以查看官方文档

更换主题

下载主题

git clone https://github.com/iissnan/hexo-theme-next themes/next

配置主题

在网站配置文件_config.yml中,配置theme

theme: next

部署到Github

创建github帐号

创建xxx.github.io的仓库,xxx要和github帐号的名称一样

安装 hexo-deployer-git

npm install hexo-deployer-git --save

网站配置git

在网站的_config.yml中配置deploy

deploy:
  type: git
  repo: https://sym9518:1397276116Sha@github.com/sym9518/sym9518.github.io.git
  branch: master

还有一种ssh的方法,暂时不用,后续如果这种方法出现错误,再补充

repo: https://{yourname}:{yourpassword}@github.com/{yourname}/{yourname}.github.io.git

git version 2.19.1 windows.1
npm version 6.4.1
node version 8.12.0

posted on 2019-07-01 11:37  sym9518  阅读(109)  评论(0)    收藏  举报

导航