halo icon indicating copy to clipboard operation
halo copied to clipboard

主题增加模板标签功能,获取不同类型的文章列表

Open ttiv opened this issue 2 years ago • 4 comments

你当前使用的版本

2.2.0

描述一下此特性

针对2.0版本的主题,希望增加更多获取文章的方式。例如:

  1. 查询所有已设置为 置顶 的文章列表 场景:首页轮播图展示 最新的5条置顶文章

  2. 阅读量倒序 查询文章列表 场景:文章页面右侧栏热门文章模块,倒序展示 阅读量最高的10条文章

  3. 评论量倒序 查询文章列表 场景:文章页面右侧栏评论排行模块,倒序展示 评论量最高的10条文章

附加信息

image

ttiv avatar Feb 21 '23 12:02 ttiv

/kind feature /area core

ruibaby avatar Feb 22 '23 09:02 ruibaby

微信截图_20230415202219

建议加几个comparator , 然后thymeleaf里就能对listAll() 的结果进行排序。 thymeleaf里不支持用属性名进行排序。

LookUpPls avatar Apr 15 '23 12:04 LookUpPls

我把joe迁移halo2 就只能显示最新文章,其它的 热门文章, 最多点赞, 最近更新都没法显示

LookUpPls avatar Apr 15 '23 12:04 LookUpPls

image

因此我并不能通过使用如下代码去实现排序和过滤:

postItems=${#lists.sort(postFinder.listAll(), T(java.util.Comparator).comparingInt(T(run.halo.app.theme.finders.vo.ListedPostVo).getStats().getVisit()).reversed())}

carolcoral avatar Dec 26 '23 09:12 carolcoral