使用hexo搭建自己的博客

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_31851435/article/details/89209160

1、在github注册一个自己的帐号

https://github.com


2、在github里新建一个项目,项目必须要遵守格式:账户名.github.io,不然接下来会有很多麻烦。并且需要勾选Initialize this repository with a README

访问地址

https://{你的用户名}.github.io/

例如:https://bupamafandeluwan.github.io/


3、本地需要安装Node.js和Git,然后再安装hexo-cli

$ npm install -g hexo-cli

4、新建一个博客项目文件夹,进入文件夹目录初始化

$ hexo init

5、安装npm依赖

npm install

6、创建文章

$ hexo new [layout] <title>

7、生成静态文件在publish目录下

$ hexo generate


8、使用插件一键部署

安装 hexo-deployer-git

$ npm install hexo-deployer-git --save

在开始之前,您必须先在 _config.yml 中修改参数,一个正确的部署配置中至少要有 type 参数

deploy:
  type: git
  repo: <repository url> // 库(Repository)地址
  branch: [branch] // 分支名称。如果您使用的是 GitHub 或 GitCafe 的话,程序会尝试自动检测。
  message: [message] // 自定义提交信息 (默认为 Site updated: {{ now('YYYY-MM-DD HH:mm:ss') }})

执行命令自动提交编译后的代码

$ hexo deploy


 

猜你喜欢

转载自blog.csdn.net/qq_31851435/article/details/89209160