Quantcast
Channel: C1 CMS Foundation - Open Source on .NET
Viewing all articles
Browse latest Browse all 2540

New Post: How can i access created date and published date on a page?

$
0
0
I'm creating a small Razor function that lists a bunch of articles. And i'd like to show the date that the articles was published in my list.

So far i have this code, which gets me articles.
    @{
        var pageType = (from p in Data.Get<IPageType>()
                                        where p.Name.Equals("Article")
                                        select p).FirstOrDefault();

        Guid currentPageGuid = CurrentPageNode.Id;

        var elements = from s in Data.Get<IPage>()
                                     where s.PageTypeId.Equals(pageType.Id) && s.GetParentId().Equals( currentPageGuid )
                                     orderby s.Title
                                     select new
                                     {
                                         Id = s.Id,
                                         Title = s.Title
                                         
                                     };

        foreach (var item in elements)
        {
        <h1><a href="/page(@item.Id)">@item.Title</a></h1>                      
        }                            
    }
But i cannot find anything about dates on the IPage object.

How can i find it?

Viewing all articles
Browse latest Browse all 2540

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>