Skip to main content

Back-End Development

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.

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!

Leave a Reply

Your email address will not be published. Required fields are marked *

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