mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-12 20:15:25 +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.
20 lines
679 B
HTML
20 lines
679 B
HTML
{{/*
|
|
Get Block Scripts
|
|
Discovers and returns a slice of JavaScript files for blocks used on the current page.
|
|
*/}}
|
|
{{ $block_scripts := slice }}
|
|
{{ if .IsPage }}
|
|
{{/* Get the list of unique block types used on this page from the Page Store */}}
|
|
{{ $block_types := .Page.Store.Get "block_types" | default (slice) | uniq }}
|
|
|
|
{{ range $block_type := $block_types }}
|
|
{{/* Check if a JS file exists for this block type */}}
|
|
{{ $script_path := printf "js/hbx/blocks/%s/%s.js" $block_type $block_type }}
|
|
{{ with resources.Get $script_path }}
|
|
{{ $block_scripts = $block_scripts | append . }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ return $block_scripts }}
|
|
|