November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Ok. Update. After much testing I know seem to get all children (decendents). English version:
Norwegian version
But when I use this extension I only get the EN version of the page. Why? And how do I get the NO version link?
public static string GetExternalUrl(this ContentReference contentLink)
{
if (contentLink.IsNullOrEmpty()) return null;
var urlResolver = ServiceLocator.Current.GetInstance<IUrlResolver>();
var internalUrl = urlResolver.GetUrl(contentLink);
if (string.IsNullOrEmpty(internalUrl)) return null;
var url = new UrlBuilder(internalUrl);
EPiServer.Global.UrlRewriteProvider.ConvertToExternal(url, null, Encoding.UTF8);
return UriSupport.AbsoluteUrlBySettings(url.ToString());
}
As you can see I do have the correct language version. But the link still is EN version.
The LinkURL "/link/3edeeac25cd246c9919edfe403c6f020.aspx" also points to EN version
Ok extremely ugly solution, but it works. Does anyone have any other nicer solution?
private string BuildUrlSegments(PageData page, CultureInfo culture, StringBuilder sb)
{
if (page is null || page is CountryStartPage) return sb.ToString();
sb.Insert(0, page.URLSegment + "/");
var parent = _contentLoader.Get<PageData>(page.ParentLink, culture);
return BuildUrlSegments(parent, culture, sb);
}
You can use the overload which takes a language parameter
string GetUrl(ContentReference contentLink, string language, UrlResolverArguments urlResolverArguments);
My client has a structrure that looks like below.
The "Norge" has one language NO (norwegian), the first child "Produkter" (products) have a master language EN and a NO version.
The master EN on "Produkter" is expired.
The NO version on "Produkter" is published and can be accessed through menues without beeing logged in etc.
I cannot get the first child "Produkter" trough any means of code. I have tried many ways of doing this.
I have checked acccessrights.
If I skip the "FilterForDisplay" extension I can get the last child "Produkter" which someone is editing.
Anyone have an idea why this is? It's almost like the first child "Produkter" is not really under the "Norway" parent.
Worth mentioning that this is a custom controller with a custom route in global.asax.