0

I've built a custom link provider which returns the complete url when the linked item is not from context website. It works as expected on english, but even if I add options.Language = Sitecore.Context.Language; on the other languages, it doesnt work. The override method looks like below:

public override string GetItemUrl(Item item, ItemUrlBuilderOptions options)
    {
        options.Language = Sitecore.Context.Language;
        if (some_conditions)
        {
            options.AlwaysIncludeServerUrl = true;
        }

        return base.GetItemUrl(item, options);
    }

The urls look the below:

On english: http://notTheContextSite/en/TestPage - ok

On german (for example): http://contextSite/de/sitecore/content/notTheContextSite/home/TestPage - not ok

Any ideas what can I do? Thanks

4
  • Did you try to debug? Is your code being called?
    – Gatogordo
    Mar 25 '21 at 16:14
  • Is it working if you use notTheContextSite/de/TestPage? Also, how is the link provider patched in the configs? Mar 25 '21 at 17:28
  • @Gatogordo, yes, it works, when I inspect the return value of base.GetItemUrl(item, options); the url already looks as it shouldn't, on language versions.
    – iusmar
    Mar 26 '21 at 11:21
  • @CristiVulturar, it works on all pages, on all websites, in english. On language versions, the url is "broken".
    – iusmar
    Mar 26 '21 at 13:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.