30 September, 2016

Sitecore MVC – Custom Vary by cache options

Sitecore, by default, provides varies options like Vary by Data, Vary by Query String to enable HTML cache. Sometimes we need other options (based on component built type) to help the component cached by Sitecore cache.

I have created a custom module helps in adding options to cache based on URL and Rendering Unique ID.

After installation, you will see two options in caching section of rendering definition.
  • Vary by URL
    • Cache key varies by HttpContext AbsolutePath
    • Can be combined with other options like query string (existing)
  • Vary by Unique ID
    • Uses rendering unique ID
Also, page presentation component properties will have the same option and there will be an additional option to disable the rendering definition cache settings – Cancel Cache Settings. (ref link). 

Now you enable cache based on incoming URL and rendering Unique ID. Also disable the rendering cache setting in Page presentation component properties. 

01 August, 2016

Sitecore – Unlock locked item by non-admins

This is a very simple module that will help the non-admin content authors to unlock the locked items. The user has to be in a defined role to access this module.
  • A button called Unlock will be added to Publish chunk.
  • Add the Content admin who needs access to unlock item to the role - SitecoreContentAuthorUnlock
  • To unlock, content admin can click the Unlock button for locked item and item will be unlocked. 
Package will install these items
  • An assembly
  • Sitecore role – “SitecoreContentAuthorUnlock”
  • Configuration file in Includes folder
  • Button in Publish chunk (core item)
You can download the Sitecore package here and install it using Installation Wizard.

    19 May, 2016

    [Obsolete] Disable xDB in Sitecore 7.5 with Sitecore Analytics Enabled for Basic Personalization

    In our project, we use Sitecore 7.5 and we enabled Sitecore Analytics so that we can do basic personalization in the renderings. In Sitecore 7.5, we do not have CMS-Only mode like Sitecore 8.1. If we do not have xDB database setup, we have seen many repeated Mongo DB errors in the log files. Moreover these repeated logs slows down the authoring and production environment.

    We contacted Sitecore to provide a patch to disable the xDB errors and it seems it is not possible in Sitecore 7.5 but to upgrade our Sitecore instance to 8.1.

    As a workaround to disable these errors, we went ahead and disabled background services and other related configurations in Sitecore analytics. This has disabled the unnecessary errors related to Mongo DB and analytics but Sitecore basic personalization was still working for our renderings. 

    Warning: These configuration changes may affect other functionalities related to Sitecore Analytics. Due to lack of documentation on these steps, I am marking commenting and marking this blog as Obsolete. 

    • In \App_Config\Include\Sitecore.Analytics.config, modify the config values.
      <setting name="Analytics.LogLevel" value="None" />
      <setting name="Analytics.PerformLookup" value="false" />
    • In \App_Config\Include\Sitecore.Analytics.config, comment out these lines.
      	<hook type="Sitecore.Analytics.ConfigLoader, Sitecore.Analytics" />
      	<hook type="Sitecore.Analytics.BackgroundServiceLoader, Sitecore.Analytics" />
      	<processor type="Sitecore.Analytics.Pipelines.SessionEnd.RaiseVisitEnd, Sitecore.Analytics"/>
      	<agent type="Sitecore.Analytics.Tasks.EmailReportsTask, Sitecore.Analytics" method="Run" interval="0:00:00">
    • In \App_Config\Include\Sitecore.Analytics.Processing.Aggregation.ProcessingPools.config, comment out these lines.
      		<processor type="Sitecore.Analytics.Automation.Pipelines.Initialize.RegisterDataModelExtensions, 
              								Sitecore.Analytics.Automation.MongoDB" />
    • In \App_Config\Include\Sitecore.Analytics.Processing.Aggregation.Services.config, comment out these tags completely.
    • In \App_Config\Include\Sitecore.Analytics.Processing.Services.config, comment out these tags completely.

    • In \App_Config\Include\Sitecore.Analytics.Tracking.config, comment out these lines.

    • In \App_Config\Include\Sitecore.Analytics.Tracking.Database.config, comment out these lines.

    blockquote { margin: 0; } blockquote p { padding: 15px; background: #eee; border-radius: 5px; } blockquote p::before { content: '\201C'; } blockquote p::after { content: '\201D'; }