More in this section

Forums / General Discussions / How can I get the property Description or Keywords from PageNode?

How can I get the property Description or Keywords from PageNode?

2 posts, 0 answered
  1. Bruno Michels
    Bruno Michels avatar
    125 posts
    Registered:
    16 Apr 2010
    10 May 2011
    Link to this post

    var pageNodes = App.WorkWith().Pages().LocatedIn(PageLocation.Frontend)
        .Where(p => p.ApprovalWorkflowState.Value == "Published")
        .Get().ToList()
        .Where(p =>
        {
            return !p.IsBackend &&
                !String.IsNullOrEmpty(p.Title) &&
                p.Description.Value.Contains("<!--WhereToBuy-->");
        })
        .FirstOrDefault();

    I've set both Description and Keywords with this value, but this property doesn't seem to be the one I am looking for. How can I access those properties?
  2. Victor Velev
    Victor Velev avatar
    1345 posts
    Registered:
    06 Jul 2015
    12 May 2011
    Link to this post
    Hello Bruno,

    Please refer to the code sample bellow which contains the needed logic if you want to get page's description and keywords ( feel free to customize it so it suits your needs):

    App.WorkWith()
                  .Pages()
                  .Where(p => p.ApprovalWorkflowState.Value == "Published")
                  .Where(p => p.Page.Status == ContentLifecycleStatus.Live)
                  .ForEach(p =>
                  {
                      var htmltitle = p.Page.HtmlTitle;
                      var description = p.Page.Description;
     
                      var keywords = p.Page.Keywords;
                  })


    Best wishes,
    Victor Velev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered