Try Now
More in this section

Forums / Bugs & Issues / Telerik.Sitefinity.Pages.Model.PageNode does not contain an definition for 'Keywords'

Telerik.Sitefinity.Pages.Model.PageNode does not contain an definition for 'Keywords'

2 posts, 0 answered
  1. Chip
    Chip avatar
    14 posts
    25 Nov 2013
    02 Jun 2015
    Link to this post

    Has the way to access keywords from pages changed in recent versions? I can't find anything online, which shows a way to do it differently than my code below. I can access a page title, description, name, but when I try to get the keywords it throws an error. What am I missing?: 

    Here is my code: 


    var fluentPages = App.WorkWith().Pages();
    var childPages= fluentPages.LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend)
                        .Where(p => p.Parent.Id == currentPageID && p.NodeType == NodeType.Standard && p.GetPageData().Status == ContentLifecycleStatus.Live)
    foreach (var child in childPages)
        string thisTitle = child.Title.ToString().ToLower();
        string thisName = child.Name.ToString().ToLower();
        string thisDescription = child.Description.ToString().ToLower();
        string thisKeywords = child.Keywords.ToString().ToLower();


    ERROR:'Telerik.Sitefinity.Pages.Model.PageNode' does not contain a definition for 'Keywords' and no extension method 'Keywords' accepting a first argument of type 'Telerik.Sitefinity.Pages.Model.PageNode' could be found (are you missing a using directive or an assembly reference?)C:\Program Files (x86)\Telerik\Sitefinity 7.152\Projects\KentuckyCenterSitefinity\Mvc\Models\AllShowsModel.cs23145SitefinityWebApp

  2. Velizar Bishurov
    Velizar Bishurov avatar
    143 posts
    24 Oct 2016
    04 Jun 2015
    Link to this post
    Hi Chip,

    The error states that PageNode does not contain a definition for 'Keywords' which is correct. Keywords is a property of the PageData, so you would have to call GetPageData() on the page before accessing its keywords like so: 

    string thisKeywords = child.GetPageData().Keywords.ToString().ToLower();

    Velizar Bishurov
    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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
2 posts, 0 answered