More in this section

Forums / Developing with Sitefinity / Handler for dynamic SiteMap

Handler for dynamic SiteMap

2 posts, 0 answered
  1. Olivier
    Olivier avatar
    31 posts
    06 Aug 2012
    29 Oct 2012
    Link to this post
    Hi there.
    In my search for a multilingual sitemap handler to generate a Google acceptable sitemap XML file for our multilingual site, I started off with the SiteMap Handler from LeapFrog Interactive (BTW, Thanks to them for providing their source code!).
    Of course, it did not work with SF 5.1 we have installed, and it did not seem to handle multilingual sites.  In our case, we want the Sitemap to reflect the language version of our web site, so have a sitemap for English version of the site, and another one for the French version.
    I am now able to display the "base" language sitemap - which is English, but for some reason, the alternate language does not seem to work.
    I am getting the root node ID using this piece of code, then I recursively find all it's child pages.
    PageNode rootNode = App.WorkWith().Pages().Get().Single(p => p.Id == SiteInitializer.FrontendRootNodeId);
    The issue I have is no matter what I do, it only retrieves the English pages.
    Is there a way to specify the language of the page we need to get?
    I even tried with the following, then iterating through all the pagenodes, but I think I need to set the current thread's culture or something the like...but thread does not seem to be available at the Handler level...
    List<PageNode> startingNode = App.WorkWith().Pages().LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend).Where(p => p.ParentId == rootNode.Id).Where(p => p.AvailableCultures.Contains(CurrentLang)).Where(p => p.ShowInNavigation == true).Where(p => p.WasPublished == true).Get().OrderBy(p => p.Ordinal).ToList();
    CurrentLang is a private property in the above example.

    Your help is appreciated!
  2. Ivan Georgiev | Sitefin1ty
    Ivan Georgiev | Sitefin1ty avatar
    33 posts
    24 Sep 2012
    01 Nov 2012
    Link to this post

     Try using ThatAreForLanguage(CultureInfo language) method from your PagesFacade. Something like this 

    App.WorkWith().Pages().LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend).Where(p => p.ParentId == rootNode.Id).ThatAreForLanguage("your culture here").....
    Ivan Georgiev | Sitefin1ty
    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