Opticon Stockholm is on Tuesday September 10th, hope to see you there!
AI OnAI Off
Opticon Stockholm is on Tuesday September 10th, hope to see you there!
I figured it out - the key was to register IContentRouteRegister with SupportMultiLanguage set to false.
public sealed class CustomImageRouteRegistration : IContentRouteRegister
{
private readonly ContentRootService _contentRootService;
public CustomImageRouteRegistration(ContentRootService contentRootService)
{
_contentRootService = contentRootService;
}
public ContentRouteDefinition ContentRouteDefintion => new ()
{
Name = nameof(CustomImageRouteRegistration),
RouteRootResolver = _ => _contentRootService.Get(CustomImageRepositoryDescriptor.RepositoryKey),
ContextMode = RouteContextMode.All,
SupportMultiLanguage = false,
StaticSegments = new[] { CustomImageRepositoryDescriptor.RepositoryKey.ToLower() },
};
}
Hi folks,
I have a custom image type, for the sake of the example let's call it CustomImage inheriting ImageData.
The type is synchronized from external source, and has a separate repository descriptor CustomImageRepositoryDescriptor : ContentRepositoryDescriptorBase, which allows editors to drag and drop those images like regular uploaded media files into content areas, etc.
The handling of returning proper file to client is done by endpoint
The URL generated by following code
looks something like this
however, the CustomImage is not culture specific type, and I would like to use following URL
It's possible to remove the language code manually from generated URL, but then the URL works correctly only on Primary server, but not on Edit server (without language code on Edit it returns 404).
How can I make the IUrlResolver return URL without language code, that will work correctly both on Primary and Edit?