简介
Hexo是一个快速,简单而强大的博客框架。
安装
1 | npm install hexo-cli -g |
初始化
1 | hexo init <folder> |
这个命令会初始化博客的目录,执行命令后生成以下文件
1 | ├── .deploy #部署到GitHub上的内容目录 |
发布并打开hexo服务
1 | $ hexo g #生成 |
目前使用的hexo版本为
1 | hexo: 3.6.0 |
使用背景图片
1.站点配置
1 | post_asset_folder:true |
2.根目录下执行
1 | npm install hexo-asset-image --save |
3.命令新建文章
1 | hexo new "test" |
4.在/_posts下生成与test.md名称一样的文件夹test,代码引用图片
1 |  |
使用tags
1.新建一个页面,命名为tags。命令如下:
1 | hexo new page "tags" |
2.编辑tags文件夹下的index.md
1 |
|
3.在菜单中添加链接。编辑主题的 themes/next/_config.yml ,添加tags到menu中
1 | menu: |
使用categories
1.新建一个页面,命名为categories。命令如下:
1 | hexo new page "categories" |
2.编辑categories文件夹下的index.md
1 |
|
3.在菜单中添加链接。编辑主题的 themes/next/_config.yml ,添加categories到menu中
1 | menu: |
使用about
1.新建一个页面,命名为about。命令如下:
1 | hexo new page "about" |
2.编辑about文件夹下的index.md
1 |
|
3.在菜单中添加链接。编辑主题的 themes/next/_config.yml ,添加about到menu中
1 | menu: |
使用next主题
1.在站点根目录下运行以下命令
1 | $ git clone https://github.com/iissnan/hexo-theme-next themes/next |
2.设置站点配置
1 | theme: next |
安装hexo-git
1.安装
1 | $ npm install hexo-deployer-git --save |
2.添加部署代码
1 | # Deployment |
3.在github建立仓库,名称为username.github.io,配置好后执行命令可发布到Github Pages中
1 | $ hexo clean & hexo g & hexo d |
相关主题
- https://hexo.io/ , Hexo官网