【博客】如何在Github上创建博客
【博客】如何在Github上创建博客
1. 安装nodejs
2. 安装hexo
npm install -g hexo-cli
3. 搭建博客
$ hexo init <folder> # Hexo 将会在指定文件夹中新建所需要的文件
$ cd <folder>
$ npm install
4. 配置
我只改了title和author,url
5. 命令
hexo new "post title with whitespace" # 新建一篇文章
hexo generate # 生成静态文件
hexo server # 启动服务器
hexo deploy # 部署网站
6. 部署到Github
-
创建github仓库
打开github,新建一个repository,名称是username.github.io -
安装 hexo-deployer-git
npm install hexo-deployer-git --save
-
修改配置 _config.yml
deploy: type: git repo: <repository url> #https://bitbucket.org/JohnSmith/johnsmith.bitbucket.io branch: [branch]
-
部署
hexo deploy
7. 其他
选择主题
我选择的是 gstyle
插入侧边条目录
- 在文档的开头添加
toc:true
- 在主题的设置文件中 /themes/gstyle/_config.yml
active_nav: false
摘要
在想要显示的摘要之后添加 <!-- more -->