Episerver

Episerver – Handling an SVG image type and displaying it using a Path tag

Pexels MaurĂ­cio Mascaro 712786

Recently, I came across a requirement from a client that needed all SVG media types to render using the internal XML <Path> in the DOM, rather than using the standard <Img> tag.

This was a tricky one and there wasn’t very much information about how to accomplish this, as its not necessarily a common request. That being said, it does have its advantages, such as recoloring the vector using CSS.

SAS IDC Episerver Commerce Guide
Delivering Customer-Centric Experiences for Digital Commerce

The IDC Technology Spotlight explores the rapidly changing commerce landscape and the top 5 benefits of a modern DXP.

Get the Guide

In this post, we’re going to go through the following:

  • Creating a new Media Descriptor that will handle the SVG file format
  • Looking at how SVGs are stored
  • AzureBlob (DXP) vs FileBlob (Local)
  • Extracting the XML and returning it

You can view this article over on my blog website.

Although this works, it doesn’t mean this is the best way of doing it.

 

Please let me know your thoughts! I would love some feedback!

About the Author

More from this Author

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe to the Weekly Blog Digest:

Sign Up