Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Lee Fear 7 posts 97 karma points
    Nov 10, 2019 @ 19:47
    Lee Fear

    Get selection of document list items for homepage

    I have followed the article -

    This gets me a list of article items for a particular article parent. However if I had a number of article items under various article parents (eg news items, features etc) How would I get the last 5 of any of those items for the homepage?

  • Matthew Mirzai 24 posts 98 karma points
    Nov 11, 2019 @ 19:50
    Matthew Mirzai

    Instead of obtaining nodes by ID and getting the children, you can obtain all nodes based on what document type it is. I haven't tested it fully, but it wil be something similar to:

        var articles = Umbraco.ContentByXPath("//articlesItem")
        .Where(x => x.IsVisible())
        .OrderByDescending(x => x.CreateDate)

    Despite all the article nodes being different parents, as long as they have the same Document Type then this will work

Please Sign in or register to post replies

Write your reply to: