Hexo简单替换个主题小记
Hexo原主题首页文章内容全部展示,放不了几篇就拉的老长,看起来很不方便。
当发现 maupassant 这款简洁主题之后,随即花几分钟时间先进行简单替换,现将步骤记录如下:
安装主题和渲染器
可以通过命令进行克隆,命令
git clone https://github.com/tufu9441/maupassant-hexo.git themes/maupassant。当然也可以通过访问 github 地址
https://github.com/tufu9441/maupassant-hexo进行下载,然后拷贝到项目的themes目录下解压,并将文件夹命名为maupassant。这是我采用的方式,具体原因不详。1
2
3
4git clone https://github.com/tufu9441/maupassant-hexo.git themes/maupassant ## 执行上面的步骤后,这一句不需要再执行
npm install hexo-renderer-pug --save
npm install hexo-renderer-dartsass --save编辑 Hexo 目录下的
_config.yml,将theme的值改为maupassant。此处的maupassant和themes/maupassant中的maupassant相对应。执行生成命令
1
2
3hexo clean # 清除缓存文件 (db.json) 和已生成的静态文件 (public)。
hexo generate # 生成一套静态网页
hexo server # 运行测试,浏览器打开地址,http://localhost:4000上传生成结果
1
hexo deploy # 进行部署
完成,收工!
哪天有后记再继续写吧!
最后非常感谢大佬!
主题中文说明:https://www.haomwei.com/technology/maupassant-hexo.html