How to get pages in current language?

Posted by Community Admin on 03-Aug-2018 13:02

How to get pages in current language?

All Replies

Posted by Community Admin on 10-May-2011 00:00

I want to get a list of pages in the current culture.

I am using this to list ALL pages, how can I filter with the current culture?

var pageNodes = App.WorkWith().Pages().LocatedIn(PageLocation.Frontend).Get().ToList()
    .Where(p => p.Parent != null &&
        p.Page == null &&
        p.ShowInNavigation &&
        p.AvailableCultures.Contains(curretCulture))
    .OrderBy(p => p.Ordinal)
    .SelectMany(p => p.Nodes)
    .ToList();

Posted by Community Admin on 10-May-2011 00:00

Actually I guess the problem is the status. It is also getting some pages without title, maybe it is getting drafts or something.

I've added "where title is not null" on this filter, it already helps.

Posted by Community Admin on 17-May-2011 00:00

Hi Bruno,

Depending on what you need you can also use the sitemap:

  var rootnode = SiteMap.RootNode.RootNode;
            if (rootnode.HasChildNodes)
            
                var nodes = rootnode.GetAllNodes();

                foreach (SiteMapNode node in nodes)
                                    
                    if (!string.IsNullOrEmpty(node.Title))
                    
                        this.Page.Response.Write(node.Title);
                    
                
            

Best wishes,
Pavel
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

This thread is closed