Skip to main content

SVG Files and Sitecore

Sitecore by default does not support the SVG image types. You'd have to incorporate the following in your web.config to be able to make SC serve the SVG as an image instead of a file for download.

       <mediaType name="SVG image" extensions="svg">
          <mimeType>image/svg+xml</mimeType>
          <forceDownload>false</forceDownload>
          <sharedTemplate>system/media/unversioned/image</sharedTemplate>
          <versionedTemplate>system/media/versioned/image</versionedTemplate>
          <mediaValidator type="Sitecore.Resources.Media.ImageValidator"/>
          <thumbnails>
            <generator type="Sitecore.Resources.Media.ImageThumbnailGenerator, Sitecore.Kernel">
              <extension>png</extension>
            </generator>
            <width>150</width>
            <height>150</height>
            <backgroundColor>#FFFFFF</backgroundColor>
          </thumbnails>
        </mediaType>
-----------------------------------------
<staticContent>
      <remove fileExtension=".svg" />
      <mimeMap fileExtension=".svg" mimeType="image/svg+xml"/>
      <mimeMap fileExtension=".woff" mimeType="application/x-woff" />
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="1.00:00:00" />
</staticContent> 

Comments

Popular posts from this blog

Add Export to File Functionality in Sitecore's Search Options

One of our business users was requesting for a listing of items they've already added and have it available in a format that can be opened in a spreadsheet (Excel). My initial thought was to create a blank aspx page and write all the logic to get the data in the code-behind, run it and save the resulting file to a csv then I'm done.
But then it got me to think, it might be a better idea to have this functionality plugged in to Sitecore and made available for everyone to use.  Sitecore Bucket's Search Options fly-out seemed a good candidate for this feature (See image below). So doing some quick readings I got myself in to the "zone" and started implementing this quick and dirty PoC.

Just to explain what it actually does.

User will basically do a search, (Note that all search options require some filters or search keyword before any of the options can be used) clicks the Export to File, it pops up a dialog to confirm the action and executes, after which a browser-…

Rich Text Editor (RTE) Stripping Script tags

Ran across an issue today wherein one of our Content Editors was complaining that their page was not working, i.e. some page scripts where not firing.
Upon closer inspection, we found out that their content inside their RTE was missing.
We added them back but, it just kept getting stripped-off when we close the editor.
This did not happen to us before when we were using SC6.5, so this basically smells more like an upgrade issue.
I scanned all of the config changes (I kept a log) and found one curious setting:

<setting name="HtmlEditor.RemoveScripts" value="true" />

This setting was by default removing any embedded scripts inside the RTE.
Just turn it off in your CM and keep it on in your CD.