Skip to main content

Posts

Sitecore Cache Tuning

High performance for any digital platform is elementary. In this post, I will address some basics around Sitecore caching and some best practices that Sitecore developers/architects can follow to boost the performance of Sitecore solution. While working with one of our clients, content authors started complaining about the page load time in experience editor. The environment was Azure IaaS. So, we started looking at all the performance tweaks we could apply. Sitecore Cache Tuning Performance and cache go hand-in-hand :D  So first thing we wanted to explore was Sitecore caching especially the cache sizes.  I assume the readers are already aware about Sitecore caches and  how to configure them . We used the showconfig.aspx (https://<my sitecore hostname>/sitecore/admin/showconfig.aspx ) and looked especially for Sitecore's prefetch, items and data cache sizes. So, how do we  know if the cache sizes are sufficient for our application? First, you need to open Cache Administration

Sitecore PowerShell Script to create all language versions for an item from en version

  We have lots of media items and our business wants to copy the data from en version of media item to all other language versions defined in System/Languages. This ensures that media is available in all the languages. So, we created the below powershell script to achieve the same -  #Get all language versions defined in System/Languages $languages = Get-ChildItem /sitecore/System/Languages -recurse | Select $_.name | Where-Object {$_.name -ne "en"} | Select Name #Ensuring correct items are updated by comparing the template ID  $items = Get-ChildItem -Path "/sitecore/media library/MyProjects" -Recurse | Where-Object {'<media item template id>' -contains $_.TemplateID} #Bulk update context to improve performance New-UsingBlock (New-Object Sitecore.Data.BulkUpdateContext) { foreach($item in $items){    foreach($language in $languages){ $languageVersion = Get-Item -Path $item.Paths.Path -Language $language.Name #Check if language versi

Export Sitecore media library files to zip using SPE

If you ever require to export Sitecore media files to zip (may be to optimize them), SPE (Sitecore Powershell Extension) has probably the easiest way to do this for you. It's as easy as the below 3 steps -  1. Right click on your folder (icons folder in snap)>Click on Scripts> Click on Download 2. SPE will start zipping all the media files placed within this folder. 3. Once zipping is done, you will see the Download option in the next screen. Click Download Zip containing the media files within is available on your local machine. You can play around with the images now. Hope this helps!! Like and Share ;)

New Features in Sitecore 10 : Is it Worthy?

Finally Sitecore 10  is out and all the Sitecore developers are going crazy at this moment, especially the MVPs :P LinkedIn has flooded with Sitecore 10 blogs about the first installation experience, the introduction of new features etc. So I got curious ( like w asnt 9.3 launched a while back.. )  and, when got a chance, deep dived into the Sitecore 10 Release Notes to understand what the newer version brings to the table for developers. Here is the list of Sitecore 10 features which I believe still makes it worthy in content management ecosystem - Infrastructure-as-code - Sitecore 10 officially supports Docker, Kubernetes and new Sitecore-provided image repositories. This is really going to speed up on-boarding process for new developers into the project. So, Infrastructure-as-code enables the local setup to be source controlled (like code). New members have to setup the local repository and run few commands to setup their local instance. What's even greater is that the local se

How to push items linked in rendering data sources to next workflow state in Sitecore

Workflow implementation is important for content governance. When content author updates a page in Sitecore experience editor, Sitecore notifies content author to submit the page to push it to next workflow state.  But what about the rendering data sources present on the page. Do they get pushed to next workflow state or not?  Sitecore does push the rendering data source items present on page to next workflow state if you have the below setting set to true in your configs (which is true by default Sitecore 8.2 onwards) -  <setting name="WebEdit.AffectWorkflowForDatasourceItems" value="true" patch:source="Sitecore.ExperienceEditor.config"/> However, that's not all. Some of the rendering data sources may be dependent on other items (we will call them linked items), especially for container renderings (which act as container for other data items). There is no setting in Sitecore OOB that can push the linked items to next workflow state. Content auth

Check for lock on Sitecore Item

A page in Sitecore consists of multiple renderings with multiple data sources. Content authors need to acquire lock on a page to edit the page. When content authors save the component and submits it to next stage in workflow, Sitecore makes a check whether the context user has enough rights and the lock on the item (data source or page) to push it to next workflow. This is needed to make sure that the content author doesn't push an item that is not locked by it to next workflow. This is done using the below condition -  if (item.Access.CanWrite() && (!item.Locking.IsLocked() || item.Locking.HasLock())) This condition is useful when we are building a customization related to workflow processing or experience editor's inline editing functionality. 

Custom Buttons in Sitecore Experience Editor

Experience editor gives WYSIWYG (What you see is what you get) experience to content authors in Sitecore. Most of the fields defined in templates for components are directly editable in the experience editor mode including images, text, links and many others (Thanks to the Sitecore field renderers implemented in the view!) However, there are scenarios in which some of your fields won’t be easily editable on the page in the experience editor. For example, if you want to provide spacing or width options in a component to content author, they are not directly editable within experience editor like the images and text. Such fields are usually created using droplinks or check boxes. In such cases, it is desirable to create a custom button that will let you edit such fields. This custom button will be visible in experience editor when user clicks on the rendering. On clicking this custom button, a dialog containing the fields that we want to edit in experience editor will open up.  Steps to