Butterfly魔改10:给标签添加次方篇数
效果
效果如下图:

步骤
在主题文件中找到./scripts/helpers/page.js
,搜索cloudTags
,把函数最后的{tag.name}
改成:
{tag.name + '<sup>' + tag.posts.length + '</sup>'} |

过程
记录一下寻找过程,也许对你会有启发:
我是先找到./layout/tag.pug
这个文件,看内容不是
然后我找到./layout/page/tags.pug
这个文件,如下:
.tag-cloud-list.text-center |
发现这个cloudTags
是我要寻找的函数
然后我在theme根目录下打开git bash,使用grep来搜索cloudTags
函数,如下:

最后找到了./scripts/helpers/page.js
这个文件
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 Diraw的世界!
右侧切换GitHub或邮箱评论
GiscusTwikoo