Configure Sitecore to update sitemap xml on CM and CD servers

In a scalable environment the expectation is to have multiple servers serving the content(s) to different regions(or sometime same region as well), the typical architecture is to have one content management server and atleast one content delivery server.

Sitecore provides “Sitemap XML module“, when we publish content(s) it will generate an updated Sitemap.xml file – basically, a listing of page(s) that a web-crawlers can use to crawl and index a site.

sitemapxml

When we have content delivery servers set up as part of the configuration, we have to make sure that Sitemap.xml file also gets updated to CD servers which doesn’t happen by default, only content management file gets updated.

In order to make sure we Sitemap.xml file getting updated to the servers, we have to add following  to events section:

<event name=”publish:end:remote”>
<handler type=”Sitecore.Modules.SitemapXML.SitemapHandler, Sitemap.XML” method=”RefreshSitemap” />
</event>

This will updated the Sitemap.xml file in content delivery servers as well.

Note: Please refer this URL which explains about the same issue and resolution-

https://www.captechconsulting.com/blogs/sitecore-sitemap-shared-source-module-configuing-for-scaled-environments

Happy learning 🙂

Resolving issue with page preview in Sitecore multisite configuration

With Sitecore multisite solution and architecture, we see site resolving logic might seem to work in unexpected ways sometime,and i encountered this issue couple of weeks back, here are few things to consider with Sitecore multisite configuration.

Let’s assume we have two sites in the same Sitecore instance, this is how the typical structure looks like:

pagepreview

In order to have two sites in the same Sitecore instance, we also need to add site node settings which is present as part of Sitecore.config now,this is how it looks:

<site name=”website” enableTracking=”true” virtualFolder=”/” physicalFolder=”/” rootPath=”/sitecore/content” startItem=”/home” database=”web” domain=”extranet” allowDebug=”true” cacheHtml=”true” htmlCacheSize=”50MB” registryCacheSize=”0″ viewStateCacheSize=”0″ xslCacheSize=”25MB” filteredItemsCacheSize=”10MB” enablePreview=”true” enableWebEdit=”true” enableDebugger=”true” disableClientData=”false” cacheRenderingParameters=”true” renderingParametersCacheSize=”10MB” />

<site name=”my-new-site”…../>

<site name=”website”….> is the default setting that comes with Sitecore, we need to add any new site added to system here, so that site can be resolved, in this example we added “my-new-site” to the list.

It is recommended to keep the Rendering.SiteResolving setting value at “true” for any multisite solution in order to ensure that cross-site links are built with the correct parameters.
Here, the Experience Editor and Preview mode are opened in the context of the site defined in the Preview.DefaultSite setting.

In my case, I observed the page preview mode was throwing error, and when i looked into the “Preview.Default” setting in Sitecore.config file, it was pointing to “website
We had “website” site node , but the location was no longer exists- it was pointing to /sitecore/content/home and we didn’t had any item in this location.

So, there are two options here to resolve this issue:

  1. Update the “website” site node start item in Sitecore.config to point to active site/ location or
  2. Update “Preview.DefaultSite” mode settings with an active site.

Note: Please make any updates to Sitecore.config using Sitecore patch file, so that we don’t mess up anything with the default configurations, and down the line didn’t face any issue with Sitecore upgrade as well.

Also, to make sure that items are opened in context of correct site, we must set the Rendering.SiteResolvingMatchCurrentSite setting to “true”

All configs related to site resolving can be found (“/App_Config/Sitecore.config” in Sitecore 8.x and web.config in 7.x)

Please read more about the site resolving here- https://kb.sitecore.net/articles/986056

Happy learning 🙂