{{/* Audio Shortcode for Wowchemy. */}}
{{/* Load audio from page dir falling back to media library at `assets/media/` and then to remote URI. */}}
{{/* Supports primarily MP3 and MP4. */}}

{{ $destination := .Get "src" }}
{{ $is_remote := strings.HasPrefix $destination "http" }}
{{- $asset := "" -}}
{{- if not $is_remote -}}
  {{- $asset = (.Page.Resources.ByType "image").GetMatch $destination -}}
  {{- if not $asset -}}
    {{- $asset = resources.Get (path.Join "media" $destination) -}}
  {{- end -}}
{{-