Closed imlifengfeng closed 3 years ago
我的怎么不显示标签??怎么弄的
这个主题很好,很精简。请问首页侧边栏标签个数如何设置?标签显示太多了。
@imlifengfeng 我没找到怎么设置标签个数,但是可以直接把它关掉
$ vim themes/maupassant/_config.yml
widgets: ## Six widgets in sidebar provided: search, category, tag, recent_posts, rencent_comments and links.
- search
#- category
#- tag
- recent_posts
#- recent_comments
#- links
@jiangleiundo 你说的是目录category
吧?还是没有文章
可以关闭标签,然后在把标签放到导航栏中去
@imlifengfeng 博客侧栏的标签使用的是官方提供的 tagcloud
制作的,你可以先去读一下官方文档里面关于 tagcloud
的配置信息,很容易理解。
博客关于侧栏标签页的设置文件是博客文件夹中的 layout/_widget/tag.pug
,你可以自己去修改其中的参数实现数量控制,即官方文档中提到的 amount
参数来设置标签显示最大数量,但是这样是存在缺点的,一般我们想控制数量是想让我们用的最多的标签显示出来,而这个只是显示我们排序的前面 n 个标签,所以我这里有一个优化方案,我的优化代码如下:
for tag in site.tags.toArray()
if tag.length > theme.featuredsize
a( href='/tags/' + tag.name title=tag.name rel= tag.length ) #{tag.name}
其中 theme.featuredsize
为在博客的 _config.yml
中添加的配置,作用是判断该标签中大于多少篇文章我就把该标签设为精选放在侧栏中。
效果可以参考我的博客:hushhw's blog
把标签单独一页列出来,然后把右侧边栏的删去,可以参考我的:http://huanyouchen.github.io/tags/
这个主题很好,很精简。请问首页侧边栏标签个数如何设置?标签显示太多了。
maupassant\layout\_widget\tag.pug
修改 amount: 100
如果你想显示成1个就修改为amount: 1
@huanyouchen 你这个是怎么实现的呢,能否指导一下呀?
看到了hushhw的解决方案,maupassant主题创建Tags页面 https://wiki.hushhw.cn/%2Fposts%2F5e14d0e.html
@NonEvent 感谢提醒,我看了效果很不错,我已经添加上了。 @hushhw 还对主题的其它一些地方做了不少优化,都很好看,比我强多了😂
这个主题很好,很精简。请问首页侧边栏标签个数如何设置?标签显示太多了。