0

We upgraded from Sitecore 8.7 to Sitecore 10.1. We are experiencing multiple issues using the Link Provider.

  1. When using the existing Sitecore 8.7 LinkProvider code in Sitecore 10, we have observed significantly faster site loading times. However, if we remove the LinkProvider code in Sitecore 10, the sites become very slow.

  2. Another issue we have encountered is that some links on the Auth Site are appending Prod Targethostname URL when the existing Sitecore 8.7 LinkProvider code is used in Sitecore 10. For instance, when clicking on a search URL, the resulting URL is displayed as https://test1-sc10-auth.comhttps//test1-sc10.com/search-results#e=0&q=news. To resolve this issue, we can either untick Enable Preview in Auth and Prod site groupings, or remove the code from the config. However, removing the code causes a decrease in performance when loading a site.

sitegroup

Sitecore 8.7 LinkProvider code

public class MultisiteItemLinkProvider : LinkProvider
{
    public override void Initialize(string name, NameValueCollection config)
    {
        Assert.ArgumentNotNullOrEmpty(name, "name");
        Assert.ArgumentNotNull(config, "config");
        base.Initialize(name, config);
    }

   //code
}

config file

<linkManager>
  <patch:attribute name="defaultProvider" value="MultisiteItemLinkProvider" />
  <providers>
      <add name="MultisiteItemLinkProvider"
           fallback="sitecore"
           type="Foundation.Multisite.Providers.MultisiteItemLinkProvider, Foundation.Multisite"
           addAspxExtension="false"
           alwaysIncludeServerUrl="false"
           encodeNames="true"
           languageEmbedding="asNeeded"
           languageLocation="queryString"
           lowercaseUrls="true"
           shortenUrls="true"
           siteResolving="true"
           useDisplayName="false" />
  </providers>
</linkManager>

I tried to replace LinkProvider with ItemUrlBuilder in Sitecore 10

public class MultisiteItemLinkProvider : ItemUrlBuilder
{
    public MultisiteItemLinkProvider(DefaultItemUrlBuilderOptions defaultOptions) : base(defaultOptions)
    {
    }
    //code
}
    

In the config

<links>
    <itemUrlBuilder type="Sitecore.Links.UrlBuilders.ItemUrlBuilder, Sitecore.Kernel">
        <patch:delete />
    </itemUrlBuilder>

    <itemUrlBuilder type="Foundation.Multisite.Providers.MultisiteItemLinkProvider, Foundation.Multisite">
        <param desc="defaultOptions" type="Sitecore.Links.UrlBuilders.DefaultItemUrlBuilderOptions, Sitecore.Kernel">
            <alwaysIncludeServerUrl>true</alwaysIncludeServerUrl>
            <languageEmbedding>always</languageEmbedding>
            <languageLocation>filePath</languageLocation>
            <lowercaseUrls>true</lowercaseUrls>
            <encodeNames>true</encodeNames>
            <useDisplayName>false</useDisplayName>
            <addAspxExtension>false</addAspxExtension>
            <siteResolving>true</siteResolving>
            <shortenUrls>true</shortenUrls>
        </param>

    </itemUrlBuilder>
</links>

But sites are still slow using ItemUrlBuilder compare to using the LinkProvider code

Any suggestions or solutions to these issues would be appreciated. Thank you in advance.

1
  • 1
    This looks like an issue internal to your application. I will first strip off any customization around link provider and then test the pages. If they still load slow, it is probably not due to link provider as Sitecore out-of-box link provider in Sitecore 10 works fine. It is also possible some of your components like header or footer might be slowing down your application. You should probably start adding multiple debug points on your page components to find which piece is problematic. You should use tools like Sitecore Debugger etc. to analyze the pages.
    – Ghan
    Apr 21, 2023 at 15:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.