mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-12 18:15:31 +00:00
BREAKING CHANGE Module paths moved to `github.com/HugoBlox/kit` with new names: - core `blox-tailwind` → `blox` - analytics → `analytics` - netlify → `integrations/netlify` - slides (reveal) → `slides` Update go.mod, module.yaml/params, scripts, tests, and v0.11 migration guide accordingly.
22 lines
760 B
HTML
22 lines
760 B
HTML
{{/* Function to inject custom code into layouts without overriding files. */}}
|
|
{{/* Input: hook folder name (str) */}}
|
|
{{/* Output: loaded (bool) */}}
|
|
|
|
{{ $loaded := false }}
|
|
{{ $partial_dir := printf "hooks/%s/" .hook }}
|
|
{{ $context := .context }}
|
|
{{ $hook_dir_path := path.Join "layouts/_partials" $partial_dir }}
|
|
{{ with try (os.ReadDir $hook_dir_path) }}
|
|
{{ with .Value }}
|
|
{{ range . }}
|
|
{{ if not .IsDir }}
|
|
{{ $partial_path := path.Join $partial_dir .Name }}
|
|
{{ partial $partial_path $context }}
|
|
{{ $loaded = true }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{/* The return statement below is for debug purposes only and prevents the above partial(s) being included in the page */}}
|
|
{{/* return $loaded */}}
|