Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我已经关注了这篇文章:-
https://our.umbraco.com/documentation/tutorials/creating-basic-site/articles-parent-and-article-items/
这为我提供了特定文章父项的文章项目列表。但是,如果我在不同的文章父项下有许多文章项目(例如新闻项目、功能、评论等),我将如何获得主页上这些项目中的最后 5 个?(所有项目将属于相同的文档类型)。
使用上面引用的页面,只需将 .Take(5) 添加到查询的末尾,如下所示:
@{ var selection = Umbraco.Content(Guid.Parse("c4b9c457-7182-4cfb-a1af-f0211d67ea51")) .Children("articlesItem") .Where(x => x.IsVisible()) .OrderByDescending(x => x.CreateDate) .Take(5); }