Svg assets produce only video/ can't read their extension right?

I have an issue with the svg format (maybe ?). I use this to treat the different cases according to object types:

{{ $Type := ""}}
{{ if in (slice ".webp" ".png" ".jpg" ".gif") (path.Ext $destination.Path) }}
	{{ $Type = "image"}}
{{ else if eq (path.Ext $destination.Path) "svg"}}
	{{ $Type = "svg"}}
{{ else}}
	{{ $Type = "video"}}

And the video tag should only be injected when is injected only when the extension is neither not an image.

{{ if eq $Type "video" }}
	<video autoplay loop muted controls poster{{with .Attributes.loading}} fetchpriority=high{{end}}>
	    <source width=2OO src="{{ $img.Permalink }}" type="video/{{path.Ext $destination.Path}}">
	    There should have been a video here but your browser does not seem to support it.
{{ else }}
	<a href="{{$link}}" target="_blank">
	{{ if eq $Type "image"}}
	<img <!-- blablabla srcset sizes></a>
	{{ else if eq $Type "svg"}}
<img src="{{$img.Permalink -}}" >

Yet this image:
![Ancient machines4](/Images/history/antiquity/roman_ancient_engineering4.svg) does not trigger the right branch of the if statement… I get a video. All svg files (in global assets) produece a video element. At least I know for sure it does pass through the render-hook. Is my code wrong ?

You are comparing .svg to svg.

1 Like