{{- $src := $.Page.Resources.GetMatch ($.Get 0) -}}
{{- if ( not $src ) -}}
  {{- errorf "No Page Resource found for src '%q' (%q).\n\n\tAvailable Page Resources are:\n\t\t%v" ( $.Get 0 ) .Page.File.Path $.Page.Resources -}}
{{- end -}}

{{- with $src -}}
  {{- .RelPermalink -}}
{{- end -}}