summaryrefslogtreecommitdiff
path: root/themes/itheme/layouts/partials/function/resource.html
diff options
context:
space:
mode:
Diffstat (limited to 'themes/itheme/layouts/partials/function/resource.html')
-rw-r--r--themes/itheme/layouts/partials/function/resource.html16
1 files changed, 16 insertions, 0 deletions
diff --git a/themes/itheme/layouts/partials/function/resource.html b/themes/itheme/layouts/partials/function/resource.html
new file mode 100644
index 0000000..2febef3
--- /dev/null
+++ b/themes/itheme/layouts/partials/function/resource.html
@@ -0,0 +1,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 -}}