Copied to clipboard

Flag this post as spam?

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


  • Burichan 17 posts 129 karma points
    Jan 31, 2017 @ 14:16
    Burichan
    0

    Articulate - Load more posts functionality issue

    Happy Tuesday to everyone,

    I'm working on my personal blog, which is based on Articulate plugin. But I'm stuck now for days on the "Load more posts" functionality. I'm aware of the default pagination system that Articulate provides, but I'd like to test myself by implementing the infinite scroll.

    For this functionality I've used a simple UmbracoApiController:

    [System.Web.Http.HttpGet]
        public object LoadMore(int id) {
    
            var posts = new List<int>();
            var tail = Umbraco.TypedContent(id);
            var archive = tail.Parent;
    
            foreach (var post in archive.Children.OrderByDescending(x => x.CreateDate).Take(4)) {
                posts.Add(post.Id);
            }
    
            return new { FetchMade = true, Posts = posts };
        }
    

    The problem here is that I cannot access all of the "post" fields in this foreach. E.g "PublishedDate" doesn't show up if I type "post.". Only some of the fields show up. But when I debug this code, "post" has inside it all of the desired fields that I'm looking for...

    Why is this happening? :(

    Edit: Long story short, I can't find a better way to access my posts (a.k.a Archive), so I can take some of them and load them on the homepage.

Please Sign in or register to post replies

Write your reply to:

Draft