Posted on 22/01/2018 15:39:40
Hi David
You have 2 options - you can either loop the language version of the pages or use "Navigation tags" - see link in the example below. You usually would never want to use URLs to parse information.
Option 1
//Find the page in the master language and loop its language versions
var myHomePage = Services.Pages.GetPage(1);
foreach(var languageVersionsOfHomePage in myHomePage.Languages)
{
//If one of the language versions of the page matches the current area, use the id and name for a link or something.
if(languageVersionsOfHomePage.AreaId == Dynamicweb.Frontend.PageView.Current().AreaID)
{
var name = languageVersionsOfHomePage.MenuText;
var id = languageVersionsOfHomePage.ID;
}
}
Option 2
//Using navigation tags, see http://doc.dynamicweb.com/documentation-9/content/content/pages#3241, to get a language context based page
var myLanguageContextHomePage = Services.Pages.GetPageByNavigationTag(PageView.Current().AreaID, "MyHomePage");
Hope this helps.
BR Nicolai