Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
UrlResolver.GetUrl ?
Something like:
foreach(var lang in currentPage.ExistingLanguages)
{
var langPrefix = lang.ToString();
var url = UrlResolver.Current.GetUrl(currentPage.ContentLink, langPrefix);
}
If you need absolute urls you can use the current sitedefinition like: (I'm using the Flurl nuget package to combine urls to avoid handling all the slashes etc)
var currentSitePath = SiteDefinition.Current.SiteUrl;
foreach (var lang in currentPage.ExistingLanguages)
{
var langPrefix = lang.ToString();
var url = UrlResolver.Current.GetUrl(currentPage.ContentLink, langPrefix);
var absoluteUrl = Flurl.Url.Combine(currentSitePath.ToString(), url);
}
My variable
langURL
currently returns a non-friendly URL like so: http://localhost:57299/link/457fee1669e348febf67ecb57b281945.aspx?epslanguage=de-ATIs it possible to get a friendly URL?
For each page I would like to get the friendly urls with the language flag as well, for example: