- Came across a weird issue with a client"s Sitecore instance recently where on CD instances, internal link URLs generated in Navigation or redirects are absolute URLs including hostnames but they are CM hostname instead of CDs".Sitecore version is 10.1. SXA and Commerce Storefront. On docker and AKS.After lots of digging and debugging Sitecore DLLs within docker containers, found the issue and another finding.
Debugging through the code of LinkManager.GetItemUrl, it reaches Sitecore.Links.UrlBuilders.Helpers.OptionsDecoratedSiteResolver.ResolveSite at some point like below:if SkipResolving is true, it takes site context from default which is correct.However it is false in the case and it goes to SiteResolver to resolve the site via item only. So there is a chance that item is resolved to the wrong site since both CM and CD are pointing to the same Sitecore item path and who gets resolved is all dependent on the order of the sites.But why SkipResolving is false?Out of all the code here, LanguageMatchesContextSite is false because ContextSite.Language is empty but item.Language.Name is "en".It"s all because "Language" field of site settings item(such as "/sitecore/content/tenant/Sites/siteA/Settings/Site Grouping/siteA-CM") is blank... After setting this field to "en", the issue is no longer presented.
CD generates URLs with CM hostname is because SXA site settings don"t have a language set
This one was not causing a direct issue however could potentially be one. The GetTargetHostName method on SiteInfo is like below:It"s easy to see that if Hostname contains any wildcards or pipes and TargetHostName is blank, it would just return an empty string. Which would definitely cause issues somewhere on the site.
Must set "TargetHostname" if "Hostname" contains pipes or wildcards in SXA site settings
- One of the exciting news in Sitecore world recently was the release of Sitecore Experience Edge for Content Hub (Experience Edge for XM is coming later this year, so will focus on Content Hub for now). If you haven"t heard the news yet, I strongly recommend watching this Youtube video to see it in real actions. And here is the official Experience Edge™ for Content Hub documentation for a more thorough understanding.To get a hands on demo experience with Sitecore Experience Edge for Content Hub, please talk to your Sitecore contacts for accessing the Content Hub Sandbox portal. The information below also applies to Production setup, just ignore the parts related to sandboxes.
You can use Postman to test Delivery and Preview APIs too. Below is an export of a Postman collection:3 variables are:
- You should receive the instructions and accesses to create a sandbox Content Hub environment, just enure the following when creating the sandbox
- Select version 4.0.0
- Select "Content Publishing" license
- When CH sandbox is up and running, head to Settings->PublishingSettings and ensure "Publishing enabled" is ticked and Save.
- Ensure that there are Content Collections and Content that are in Final state (This is for viewing them in Delivery API)
- Ensure that the Content Collections and Content have the green tick cloud icon that says "Published to delivery platform"
- You can generate API tokens from Settings->API Keys or from the Content Collections
- The URL to GraphQL IDE is https://[[Your demo instance hostname]]/api/graphql/preview/ide/
- Preview API endpoint for demo container is https://[[Your demo instance hostname]]/api/graphql/preview/v1
- The past year has been a weird year. It went by without much me feeling the time passing. Things happened around the world, but something also happened in our personal life.2020 was not too bad to be honest. We are positive people and of course 2021 will be even better.
- Collected from different places. For my own references:Azure Application Insights
- Daily Volume Cap
- <add key="storeSitecoreCountersInApplicationInsights:define" value="False" />
- <add key="useApplicationInsights:define" value="True" />
- <system.webServer><remove name="ApplicationInsightsWebTracking" /><add name="TelemetryCorrelationHttpModule" type="Microsoft.AspNet.TelemetryCorrelation.TelemetryCorrelationHttpModule, Microsoft.AspNet.TelemetryCorrelation" preCondition="integratedMode,managedHandler" /><add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
- <system.web><trace enabled="false" requestLimit="50" pageOutput="false" traceMode="SortByTime" localOnly="true" />
- <system.diagnostics><trace autoflush="true" indentsize="0"><listeners><add name="myAppInsightsListener" type="Microsoft.ApplicationInsights.TraceListener.ApplicationInsightsTraceListener, Microsoft.ApplicationInsights.TraceListener" /></listeners></trace></system.diagnostics>
- <!-- SERVER ROLE The name for grouping metrics from instances by server role. Default value: Single --><setting name="ApplicationInsights.Role" value="Single" patch:source="Sitecore.Cloud.ApplicationInsights.config"/>
- <!-- TELEMETRY TAGS Tags that are included in telemetry data to identify the metrics from an instance. --><setting name="ApplicationInsights.Tag" value="" patch:source="Sitecore.Cloud.ApplicationInsights.config"/>
- <!-- DEVELOPER MODE Enables developer mode in Application Insights TelemetryConfiguration. --><setting name="ApplicationInsights.DeveloperMode" value="false" patch:source="Sitecore.Cloud.ApplicationInsights.config"/>
- <pipelines><initialize><processor type="Sitecore.Cloud.ApplicationInsights.Logging.RemoveSitecoreTraceListeners, Sitecore.Cloud.ApplicationInsights" patch:source="Sitecore.Cloud.ApplicationInsights.config"/><processor type="Sitecore.Cloud.ApplicationInsights.TelemertyInitializers.InjectTelemertyInitializers, Sitecore.Cloud.ApplicationInsights" patch:source="Sitecore.Cloud.ApplicationInsights.config"/><processor type="Sitecore.Cloud.ApplicationInsights.TelemertyInitializers.AppInsightsInitializer, Sitecore.Cloud.ApplicationInsights" patch:source="Sitecore.Cloud.ApplicationInsights.config"/>
- Probably not a problem that people typically have, but if you try to install multiple Sitecore versions (before Sitecore 10, which can be done using Docker now) on the same machine, you get weird errors due to incorrect Sitecore Installation Framework(SIF) version. So here is a table to help you to use the right version of SIF.SitecoreSitecore Installation Framework9.0.x18.104.22.168.0.09.1.12.1.0 or later9.2.02.1.0 or later9.3.02.2.010.0.02.3.0And a cheatsheet for SIF.Add PowerShell repository for installing SIFInstall the latest version of SIFSee all the versions of SIF installedInstall a specific version of SIFUse a particular version of SIF for installation - this is important when installingThere is an official Sitecore KB compatibility page containing the same information:And finally, if you haven’t tried, I strongly recommend giving Docker a try for Sitecore 10 at least. It’s super easy!
subscribe via RSS