Posts

Showing posts from April, 2021

Sitecore - Animated SVGs

 For versions prior to Sitecore 8.1 update 2 some gymnastics needed to be done in order to support SVGs (you can refer to https://cmsxperience.com/2016/03/31/render-svg-images-in-razor-with-sitecore/). For later versions, that support comes OOTB. However, there might be times where we need to display animated SVGs, and those animations don't always work when the SVGs get displayed inside a <img> tag. This post is a modification to the blog post linked above, we will update the code so that our SVGs can be animated and can be available on image search:  public static MvcHtmlString RenderSvg(this HtmlHelper helper, string imageSrc, string imageAlt, string className) { if (string.IsNullOrEmpty(imageSrc)) { return new MvcHtmlString("<!-- No Image to display -->"); } return !imageSrc.Contains(".svg") ? new MvcHtmlString($"<img src='{imageSrc}' alt='{imageAlt}' clas

Sitecore - Using the recommended initial cache values

Sometimes before we deploy a website we forget to set up the recommended initial cache values (https://doc.sitecore.com/developers/91/platform-administration-and-architecture/en/recommended-initial-cache-values.html). Sitecore's documentation is pretty clear, in this post I'm just giving you the patch file you need to add to actually use these recommended initial values.  So here you go, under App_Config/Include add this patch file:  <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/" xmlns:role="http://www.sitecore.net/xmlconfig/role/"> <sitecore> <settings> <setting name="Caching.AccessResultCacheSize" set:value="200MB"/> </settings> <databases> <database id="master" role:require="ContentManagement or Standalone"> <cacheSizes> &