mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
5322a15ceb
Add `{{/* ... */}}` header comments to 25 partials that had no documentation,
enabling `pnpm gen:docs` to generate their reference docs. Also fix
base/head/index.html leading blank line that prevented parser matching.
Groups covered: base/, feed/, function/, home/, init/, plugin/, single/, store/, (root).
30 lines
904 B
HTML
30 lines
904 B
HTML
{{- /*
|
|
Resolve a Hugo resource by path.
|
|
|
|
Attempts to find the resource from page resources first, then global resources.
|
|
Returns 0 if the resource is not found.
|
|
|
|
@param {String} .Path - The resource path (page resource or global resource)
|
|
@param {Object} [.Resources] - Page resources collection
|
|
@return {resource.Resource|Number} The resolved resource, or 0 if not found
|
|
*/ -}}
|
|
|
|
{{- $Resources := .Resources | default page.Resources -}}
|
|
{{- $resource := 0 -}}
|
|
{{- $url := urls.Parse .Path -}}
|
|
{{- if not (partial "function/is-url-remote.html" $url) -}}
|
|
{{- $dest := strings.TrimPrefix "./" $url.Path -}}
|
|
{{- if $Resources -}}
|
|
{{- with $Resources.GetMatch $dest -}}
|
|
{{- $resource = . -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- if not $resource -}}
|
|
{{- with resources.Get $dest -}}
|
|
{{- $resource = . -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{- return $resource -}}
|