hexo笔记2——全文不展开、更换theme、显示categories
注: 博客=基于hexo构建的博客
0.本文常用命令
~ 本文中将用到的常用命令cd documents/zsy.hexo/hexo
hexo new "filename"
hexo g
hexo s
http://localhost:4000/Users/zsy/Documents/zsy.hexo/
1.全文不展开
~ 本节实现功能为,博客home页文章不展开全文,只显示摘要
- 参考: Hexo主页显示摘要 | Micheal’s Blog
- 方案: 在source/_post/wrt12.md正文内添加
<!-- more -->
- 经验: 本以为此功能是theme独有,需要更换theme才能实现;后偶然发现,正文中添加代码即可解决。theme->正文
2.更换theme
~ 本节实现功能为,为博客更换theme
- 参考: Themes · hexojs/hexo Wiki ; xing5/hexo-theme-codeland: Color, font, and code block optimizations based on the landscape theme.
- 方案:
- 从hexo wiki中挑选主题 -> 本人选了
codeland
- 检查hexo版本在2.4以上
hexo version
-> 本人的是hexo3.3.8 - 安装
$ git clone https://github.com/xing5/hexo-theme-codeland.git themes/codeland
- 将_config.yml的theme设定修改为
theme: codeland
- 取回远程库codeland更新
cd themes/codeland
git pull
- 查看效果
#先回到hexo目录下 $ cd documents/zsy.hexo/hexo
$ hexo g
$ hexo s
http://localhost:4000/Users/zsy/Documents/zsy.hexo/
- 从hexo wiki中挑选主题 -> 本人选了
- 经验: hexo wiki上不少theme会与本地hexo不兼容,本人本来中意的是
nadymain
,无奈css不兼容。wiki产品不兼容
3.主页显示categories
~ 本节实现功能为,主页显示categories
- 参考: category - hexo分类与tags配置 - SegmentFault
- 方案: 在正文文章添加
categories: [wrt]
- 经验: 此功能走了相当多弯路
- 弯路1.参考升级hexo的一些坑 | Joanna’s coding blog->以为可能是我的hexo版本为3.3.8,升级hexo后出现了某些不兼容,把锅都丢给不兼容
- 弯路2.尝试
hexo new page categories
并在theme配置文件里menu下添加categories: /categories
->以为categories是需要手动在menu里添加的,后来才发现下载的theme自带widget categories。 - 先假设对方正确,从自己正文源码找问题
changelog
18.02.01 bear 1hr