Copied to clipboard

Flag this post as spam?

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


  • jools 15 posts 79 karma points
    Dec 02, 2015 @ 16:11
    jools
    0

    Showing uBlogsy Posts on Homepage - need help with authors & date

    Hi

    Apologies I am very new to Umbraco and not much of a dev.

    I would like to get the 3 most recent UBlogsy posts onto the homepage.

    I have managed to display the 3 most recent posts, but having trouble displaying the author and date how I want to.

    Here is my code that I have in a Partial View Macro:

    @using System.Linq

    @using System.Xml.Linq

    @using umbraco.MacroEngines

    @using uBlogsy.Common.Extensions

    @using uBlogsy.Common.Helpers

    @using uBlogsy.BusinessLogic

    @{

    // get all posts IEnumerable

                                    .DescendantsOrSelf("uBlogsyPost")
                                    .Items
                                    .Where(x => x.GetProperty("umbracoNaviHide").Value != "1");
    
    
    List<DynamicNode> nodes = postList.OrderByDescending(x => x.GetProperty("uBlogsyPostDate").Value)
                    .Take(3)
    
                    .ToList();                  
    <div class="uBlogsy_posts_container uBlogsy_bottom_border">
        <ul>
            @foreach (DynamicNode n in nodes)
            {
                <li style="list-style: none;">
                   <a href="@n.Url">
                        <span>@n.GetProperty("uBlogsyContentTitle").Value</span>
                   </a>
                    <br>
                   <span>@n.GetProperty("uBlogsyPostAuthor").Value</span> - <span>@n.GetProperty("uBlogsyPostDate").Value.FormatDateTimeOrdinal("d.MM.yy")</span>
                </li>
            }
        </ul>
    </div>   
    

    }

    Now the author displays as the node ID but obviously I would like the actual authors name to appear.

    And for the display of the date, it currently shows as 26th.11.2015. I just need to drop the 'th' and just have numbers.

    Again aplologies if this is a simple fix, I've been at it for a while and just cant get these two fixes done

    Thanks

Please Sign in or register to post replies

Write your reply to:

Draft