 end -}}

{{ if $asset }}
  {{ $destination = $asset.RelPermalink }}
{{ else }}
  {{ $destination = $destination | safeURL }}
{{ end }}


{{ $audio_type := strings.TrimPrefix "." (path.Ext $destination) | lower }}

{{/* Set MP3 mime type to mpeg. */}}
{{ $audio_type = replace $audio_type "mp3" "mpeg" }}

<audio controls {{ with (.Get "id") }}id="audio-{{.|anchorize}}"{{end}}>
  <source src="{{$destination}}" type="audio/{{$audio_type}}">
</audio>
