hexo创建博客
hexo创建博客
- hexo是使用node.js写成的
- 先安装npm,根据不同的系统安装方法也不同,可以到官网下载安装,linux可以直接使用apt或yum install nodejs 与npm
- 由于国内访问国外的网站速度较慢,可以切换到国内的淘宝源,安装cnpm,npm install -g cnpm –registry=https://registry.npm.taobao.org
- cnpm install -g hexo-cli(linux用户可能需要自己创建符号链接)
- mkdir blog,blog文件夹就是存放博客的文件夹,名字可以随便起
- cd blog,hexo init
- hexo server,可以直接简写hexo s 启动server
- 创建自己的博客:
- cd source/_posts/下,hexo new “文章名字”
- 使用markdown编辑工具,编写博客
- 退回blog文件夹,hexo generate (hexo g)
- 在github中部署自己的hexo博客
- 在自己的github中创建仓库,名字必须是github名字.github.io(fanpengyusk.github.io)
- 使用npm安装插件,cnpm install –save hexo-deployer-git(mocos) cnpm install hexo-deployer-git –save (linux)
- 在blog文件夹中修改_config.yml文件在最底端添加字段
deploy:
type: ‘git’
repo: https://github.com/fanpengyusk/fanpengyusk.github.io
master: master安装主题
1
git clome https://github.com/litten/hexo-theme-yilia themes/yilia
修改_config.yml配置文件,将主题修改为yilia
无密码上传代码
- 可以使用ssh-keygen -t rsa -C “你的git登录邮箱”,创建rsa的公钥和私钥,将公钥上传到github上,这样就不需要每次都输入用户名和密码了
- 本文标题:hexo创建博客
- 本文作者:fanpengyusk
- 本文链接:https://fanpengyusk.github.io/posts/6f57350/
- 版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明出处!