hexo-next-设置点击头像返回主页

People who are crazy enough to think they can change the world, are the ones who do.
Apple Computers

首先启用相应的styl

1
2
3
4
5
6
7
8
9
10
11
12
13
# Define custom file paths.
# Create your custom files in site directory `source/_data` and uncomment needed files below.
custom_file_path:
#head: source/_data/head.njk
#header: source/_data/header.njk
sidebar: source/_data/sidebar.njk
#postMeta: source/_data/post-meta.njk
#postBodyEnd: source/_data/post-body-end.njk
#footer: source/_data/footer.njk
#bodyEnd: source/_data/body-end.njk
#variable: source/_data/variables.styl
#mixin: source/_data/mixins.styl
#style: source/_data/styles.styl

打开source/_data/sidebar.njk

1
2
3
4
5
6
7
8
//添加代码:
+ <a href="/">
<img class="site-author-image" itemprop="image"
src="{{ url_for( theme.avatar | default(theme.images + '/avatar.gif') ) }}"
alt="{{ theme.author }}" />
+ </a>

//这里注意找到中间头像的对应代码,添加a标签就行了,中间不用修改。

如图:

20190411-02.jpg

重新部署hexo clean && hexo s,刷新页面点击头像即可返回主页。