Post

jekyll theme chirpy avatar update

本网站基于 jekyll-theme-chirpy, 在 GitHub 上发布 post 的体验也不错,和写代码一样,git add, git commit, git push 三部曲。使用 github desktop + vscode 也很丝滑流畅。

但是本网站的用户体验还有一个痛点,就是所有页面左侧的图标一直是空白,因为不影响功能使用,所以也没有在意。今天在更新博客的时候,想起来研究一下,发现其实很简单,就是配置一下 _config.ym l文件中的 avatar 字段,指向项目中的 avatar 文件:

1
2
# the avatar on sidebar, support local or CORS resources
avatar: "assets/image/avatar.jpg"

其实在 chirpy 的 wiki 页面作者也分享过 Customize the Favicon 的方法,这是网页中的 favicon 图标,avatar 是侧边栏的头像,修改方法是还是有区别的。

需要注意的是,从 cotes2020/chirpy-starter generated 的项目,aasets 中的 lib 目录是一个链接,其指向 chirpy-static-assets。个人的 avatar 是不能上传到这个目录的,因为你大概率没有这个权限,所以需要在 assets 新建一个目录存放个人文件。

This post is licensed under CC BY 4.0 by the author.