想要的效果:

实现:
在文章 yaml 开头添加:
author: 卓别林修改themes/next/layout/_macro 的 post.swig 文档[1]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#}</{% if theme.seo %}h2{% else %}h1{% endif %}>
{% endif %}
<div class="post-meta">
{# 此位置插入作者字段 #}
{% if post.author %}
<span class="post-author" >
<span class="post-meta-item-text">作者:</span>
{{ post.author }}
</span>
<span class="post-meta-divider">|</span>
{% endif %}
<span class="post-time">
{% if theme.post_meta.created_at %}
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>注意这段代码不是全部添加进去,如果你只是添加作者字段,只需要把下面这段添加到合适的位置:
1
2
3
4
5
6
7
8{# 此位置插入作者字段 #}
{% if post.author %}
<span class="post-author" >
<span class="post-meta-item-text">作者:</span>
{{ post.author }}
</span>
<span class="post-meta-divider">|</span>
{% endif %}比如直接放在
<div class="post-meta">后面,注意缩进和实例代码一致