A001.hexo博客高级功能实现
- 1. 1. hexo初级使用
- 2. 2. hexo中级配置
- 3. 3. hexo高级配置
- 3.1. 3.1 hexo多终端写作
- 3.2. 3.2 hexo设置网站icon图标
- 3.3. 3.3 自动添加目录
- 3.4. 3.4 文章加密访问功能
- 3.5. 3.5 添加Gitment作为自己的说说/只言片语
- 3.6. 3.6 固定page页面作为首页
- 3.7. 3.7 对文章根据分类生成索引并添加菜单栏
- 3.8. 3.8 在文章中添加本地视频
- 3.9. 3.9 在文章中添加本地音乐
- 3.10. 3.10
- 3.11. 3.11 多图轮播功能
- 3.12. 3.12 添加本地pdf,并生成在线预览
- 3.13. 3.13 博客加入百度统计和google analysis
- 3.14. 3.14 Typora进行markdown写作的图片处理方案
- 3.15. 3.15 source文件夹下_post文件中Markdown文件的
这篇文章主要是用来记录下maupassant主题的优化与配置过程
1. hexo初级使用
创建新的博文(post)
1 | $ hexo new "My New Post" |
创建新的页面(page)
1 | $ hexo new page "about" |
清除缓存
1 | $ hexo |
生成hexo博客
1 | $ hexo generate |
启动服务预览
1 | $ hexo server |
1 | $ hexo server -p 5000 #更改端口 |
1 | $ hexo server -i 192.168.1.1 #自定义 IP |
关闭预览为Ctrl+C
部署
1 | $ hexo deploy |
监视文件变动
1 | $ hexo generate --watch #监视文件变动 |
2. hexo中级配置
2.1 友情链接
待写作
2.2 添加评论功能作为留言页面
待写作
2.3 菜单栏图标更换
待写作
2.4 本地搜索同时搜索所有内容
在Hexo根目录的_config.yml
文件中修改类型为all
1 | search: |
2.5 文章按照名字或者日期进行排序
待写作
2.6 文章自定义排序
待写作
2.7 建站时间
待写作
2.8 侧边栏
待写作
2.x 更多主题详细配置
https://www.haomwei.com/technology/maupassant-hexo.html
https://github.com/tufu9441/maupassant-hexo
3. hexo高级配置
3.1 hexo多终端写作
将hexo博客程序放入dropbox同步文件夹
将所有PC上的生成SSH key,并将之添加至Github
Enjoy!
3.2 hexo设置网站icon图标
若要设置网站Favicon,可以将favicon.ico放在Hexo根目录的
source
文件夹下,建议的大小:32px*32px。若要为网站添加苹果设备图标,请将命名为apple-touch-icon.png的图片放在同样的位置,建议的大小:114px*114px。
Enjoy!
3.3 自动添加目录
在文章的
front-matter
中添加toc: true
即可让该篇文章显示目录。如果需要新建文档默认显示,则直接在scaffolds目录下post的
front-matter
中添加toc: true
- 效果图
3.4 文章加密访问功能
待写作
3.5 添加Gitment作为自己的说说/只言片语
待写作
3.6 固定page页面作为首页
- 卸载hexo-generator-index插件
- 并在
source
文件夹下新建index.md作为首页内容
3.7 对文章根据分类生成索引并添加菜单栏
添加hexo-generator-index2插件
在
hexo
根目录下的_config.yml中添加以下内容,即可将所有分类名称为web的文章的索引生成后放置在public
文件夹下的web
文件夹中1
2
3
4
5
6
7
8
9
10
11
12index2_generator:
- layout: 'archive' # use existing archive layout
path: 'web' # output to web folder: http://127.0.0.1:4000/web/
per_page: 10
order_by: -date
include:
- category Web # include article which category is Web
exclude:
- tag Hexo # exclude article which tag is Hexo
- layout: 'index' # use existing index layout
path: '' # output to root directory: http://127.0.0.1:4000/
index: true # Set whether index, results is_home() is true or not在主题的菜单中添加即可
可以直接删除
hexo
根目录下的_config.yml中原先index-generator的内容,或者将之生成后放在一个目录内。再根据需要选择是否添加至菜单。1
2
3
4index_generator:
path: 'allpost'
per_page: 10
order_by: -name更多详细配置
https://github.com/Jamling/hexo-generator-index2
3.8 在文章中添加本地视频
待写作
3.9 在文章中添加本地音乐
待写作
3.10
待写作
3.11 多图轮播功能
待写作
3.12 添加本地pdf,并生成在线预览
待写作
3.13 博客加入百度统计和google analysis
待写作
3.14 Typora进行markdown写作的图片处理方案
待写作
3.15 source
文件夹下_post
文件中Markdown文件的
待写作
- 本文链接:https://blog.chendi.org/2018/08/08/A1.advanced-customization-of-hexo/
- 版权声明:The author owns the copyright, please indicate the source reproduced.