Chore: optimize .Resources variable acquisition in function resources.html

This commit is contained in:
Cell
2023-12-30 23:59:07 +08:00
parent de5fd0c3f7
commit e482fbe36a
12 changed files with 19 additions and 18 deletions
+3 -2
View File
@@ -1,8 +1,9 @@
{{- $Resources := .Resources | default page.Resources -}}
{{- $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 -}}
{{- if $Resources -}}
{{- with $Resources.GetMatch $url.Path -}}
{{- $resource = . -}}
{{- end -}}
{{- end -}}