Telerik.Sitefinity.Pages.Model.PageNode does not contain an

Posted by Community Admin on 04-Aug-2018 06:18

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

All Replies

Posted by Community Admin on 02-Jun-2015 00:00

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)
                    .ThatArePublished()
                    .Get();
 
         
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

Posted by Community Admin on 04-Jun-2015 00:00

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();

Regards,
Velizar Bishurov
Telerik
 
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
 

This thread is closed