There is a similar questions but sadly there's no help in there.
I'm trying to create a CustomLinkProvider in Sitecore 9.3 and I have 2 problems:
- The LinkProvider() is Obsolete. What should I use instead?
- The problem I'm solving is the following: I have a multisite solution. If an item from Site1 links to an item from Site2, I need whole url: options.AlwaysIncludeServerUrl = true;
The code is the following:
public override string GetItemUrl(Item item, ItemUrlBuilderOptions options)
{
if (!item.Paths.FullPath.Contains(Sitecore.Context.Site.StartItem))
{
options.AlwaysIncludeServerUrl = true;
}
return base.GetItemUrl(item, options);
}
And the app config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
<sitecore>
<linkManager>
<providers>
<add name="sitecore">
<patch:attribute name="type">namespace_name.CustomLinkProvider,dll_name</patch:attribute>
</add>
</providers>
</linkManager>
</sitecore>
</configuration>
This is not working, nor I can't debug it. Is it because it is obsolete? Any feedback, help is very welcome. Ty.