Hexo的配置

设置主题

 官方主题网站,在主题下载放到themes目录。然后修改_config.yml配置文件
 

评论插件

 使用的是Cafe主题,由于多说项目关闭,所以使用时国外Disqus评论。

 Cafe的_config.yml配置文件有说明,在博客的_config.yml文件配置disqus的账号就可以
 

注册Disqus账号

 在admin里,setting里的shortname名字才是配置到_config.yml文件中的
 

分类

 配置像这个分层次的分类
 
 

标题

使用markdown的#标题时,#和标题要隔个空格,否则解析不了。

云标签

 把Cafe的tagcloud_color设置为true
 

配置关于界面

 使用hexo new page “about”创建about的页面,在_config.yml中可以修改about名称
 

文章中插入图片

 在博客的_config.yml文件设置post_asset_folder为true。在建立文件时,Hexo会自动建立一个与文章同名的文件夹,用来放资源的。
然后安装hexo-asset-image插件npm install hexo-asset-image –save。通过下面方法就可以在文章插入图片。

1
2
![logo](本地图片测试/logo.jpg) 其中[]里面不写文字则没有图片标题。
而{% asset_img example.jpg this is an example image %} 生成HTML文件图片路径错误

RSS订阅

执行命令安装插件

1
npm install hexo-generator-feed --save

在博客的_config.yml文件配置

1
2
3
4
5
6
7
8
9
# RSS订阅支持
plugin:
- hexo-generator-feed
# Feed Atom
feed:
type: atom
path: atom.xml
limit: 20

Google Analytics

 在主题的_config.yml文件配置如下,id是Google Analytics生成的追踪id,需要去Google Analytics官网创建。

1
2
3
4
google_analytics:
enable: true
id: UA-97173941-1
site: auto

提交搜索引擎(百度+谷歌)

 参考博客