效果

效果如下图:

Image 92

步骤

在主题文件中找到./scripts/helpers/page.js,搜索cloudTags,把函数最后的{tag.name}改成:

{tag.name + '<sup>' + tag.posts.length + '</sup>'}
Image 93

过程

记录一下寻找过程,也许对你会有启发:

我是先找到./layout/tag.pug这个文件,看内容不是

然后我找到./layout/page/tags.pug这个文件,如下:

.tag-cloud-list.text-center
!=cloudTags({source: site.tags, orderby: page.orderby || 'random', order: page.order || 1, minfontsize: 1.2, maxfontsize: 1.5, limit: 0, unit: 'em'})

发现这个cloudTags是我要寻找的函数

然后我在theme根目录下打开git bash,使用grep来搜索cloudTags函数,如下:

Image 94

最后找到了./scripts/helpers/page.js这个文件