blob: 2febef3f289dfb6c33d8adab72836fc7e2870251 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
{{- $resource := 0 -}}
{{- $url := urls.Parse .Path -}}
{{- if not $url.Host | and $url.Path | and (strings.HasSuffix $url.Path "/" | not) -}}
{{- if .Resources -}}
{{- with .Resources.GetMatch $url.Path -}}
{{- $resource = . -}}
{{- end -}}
{{- end -}}
{{- if not $resource -}}
{{- with resources.Get $url.Path -}}
{{- $resource = . -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- return $resource -}}
|