HEXO是一款基于Node.js的静态博客框架,hexo github链接,本文仅是讲解入门的安装及使用方法。
前期准备
安装Nodejs
方案一
1 | sudo apt-get update |
方案二
1 | curl -sL https://deb.nodesource.com/setup | sudo bash |
方案三
1 | sudo apt-get install nodejs |
安装使用HEXO
安装
1 | npm install hexo-cli -g |
使用
- 初始化
1 | hexo init blog |
- 开启本地服务器
1 | hexo server |
- 创建新博客
1 | hexo new "Hello Hexo" |
- 生成静态博客
1 | hexo generate |
结合Github
- git的安装就不说了
- 建立Repository,命名为
{yourName}.github.io - 修改hexo根目录下的
_config.yml文件的如下内容(具体参数自行修改)
1 | deploy: |
- 执行命令
1 | npm install hexo-deployer-git --save |
- 执行命令发布博客,之后就可以通过
http://{yourName}.github.io访问到你的博客了
1 | hexo deploy |
- 之后每次修改或新写博客,需要如下命令发布修改
1 | hexo clean //若只新加可以不用执行 |
设置主题(以next为例) [next主题配置原文]
安装
1 | git clone https://github.com/xxx/xxx.git themes/xxx |
配置
1 | # hexo根目录下的`_config.yml` 修改 |
主题更新
1 | cd themes/xxx |
选择主题Scheme
1 | # 在主题目录下的`_config.yml` |
设置语言
1 | # 支持语言 |
菜单设置
1 | menu: |
菜单图标配置
1 | menu_icons: |
设置头像
1 | # 完整互联网路径 |
设置作者昵称
1 | #编辑根目录`_config.yml` |
设置描述
1 | # 编辑根目录`_config.yml` |
配置多说评论
多说评论已停止运营
1 | # 多说账号自行申请 |
推荐主题
1 | git clone https://github.com/litten/hexo-theme-yilia.git themes/yilia |
安装三方插件
显示emoji
-
卸载hexo原来的 hexo-renderer-marked 插件
1
$ npm un hexo-renderer-marked --save
-
安装 markdown-it
1
$ npm i hexo-renderer-markdown-it --save
-
安装 markdown-it-emoji 插件
1
npm install markdown-it-emoji --save
-
配置 _config.yml文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24# 在_config.yml文件中加入下面这段话
# Markdown-it config
## Docs: https://github.com/celsomiranda/hexo-renderer-markdown-it/wiki
markdown:
render:
html: true
xhtmlOut: false
breaks: true
linkify: true
typographer: true
quotes: '“”‘’'
plugins:
- markdown-it-abbr
- markdown-it-footnote
- markdown-it-ins
- markdown-it-sub
- markdown-it-sup
- markdown-it-emoji # add emoji
anchors:
level: 2
collisionSuffix: 'v'
permalink: true
permalinkClass: header-anchor
permalinkSymbol: ¶