{{ $page := .page }} {{ $url := .url }} {{ $resource := "" }} {{ with $page.Resources.GetMatch $url }} {{ $resource = . }} {{ else }} {{ with $page.Resources.Get (relLangURL $url) }} {{ $resource = . }} {{ else }} {{ with resources.GetMatch $url }} {{ $resource = . }} {{ else }} {{ with resources.Get (relLangURL $url) }} {{ $resource = . }} {{ else }} {{ with resources.GetRemote $url }} {{ $resource = . }} {{ end }} {{ end }} {{ end }} {{ end }} {{ end }} {{ if not $resource }} {{ errorf "invalid resource: %q" $url }} {{ end }} {{ return $resource }}