{{/* Hugo Blox: Tech Stack */}} {{/* Documentation: https://hugoblox.com/blocks/ */}} {{/* License: https://github.com/HugoBlox/kit/blob/main/LICENSE.md */}} {{/* Initialise */}} {{ $page := .wcPage }} {{ $block := .wcBlock }} {{ $content := $block.content }} {{ if not (reflect.IsMap $content) }}{{ $content = dict }}{{ end }} {{ $design := $block.design }} {{ if not (reflect.IsMap $design) }}{{ $design = dict }}{{ end }} {{/* Enable animations */}} {{ $animations := partial "functions/coerce_bool" (dict "value" (index $design "animations") "default" true) }} {{ if $animations }} {{ $page.Store.Set "has_animations" true }} {{ $page.Store.Set "has_alpine" true }} {{ end }} {{/* Style */}} {{ $style := "grid" }} {{ $style_raw := index $design "style" }} {{ if eq (printf "%T" $style_raw) "string" }} {{ $style_candidate := lower (strings.TrimSpace $style_raw) }} {{ if in (slice "grid" "list") $style_candidate }} {{ $style = $style_candidate }} {{ end }} {{ end }} {{ $show_levels := partial "functions/coerce_bool" (dict "value" (index $design "show_levels") "default" false) }} {{ $title := "" }} {{ $title_raw := index $content "title" }} {{ if $title_raw }}{{ $title = strings.TrimSpace (printf "%v" $title_raw) }}{{ end }} {{ $subtitle := "" }} {{ $subtitle_raw := index $content "subtitle" }} {{ if $subtitle_raw }}{{ $subtitle = strings.TrimSpace (printf "%v" $subtitle_raw) }}{{ end }} {{ $categories_raw := index $content "categories" }} {{ $categories_iter := slice }} {{ if reflect.IsSlice $categories_raw }} {{ $categories_iter = $categories_raw }} {{ else if and $categories_raw (reflect.IsMap $categories_raw) }} {{ $categories_iter = slice $categories_raw }} {{ end }} {{ $categories := slice }} {{ if gt (len $categories_iter) 0 }} {{ range $categories_iter }} {{ if reflect.IsMap . }} {{ $cat_name := "" }} {{ with index . "name" }}{{ $cat_name = strings.TrimSpace (printf "%v" .) }}{{ end }} {{ $items_raw := index . "items" }} {{ $items_iter := slice }} {{ if reflect.IsSlice $items_raw }} {{ $items_iter = $items_raw }} {{ else if and $items_raw (reflect.IsMap $items_raw) }} {{ $items_iter = slice $items_raw }} {{ end }} {{ $items := slice }} {{ if gt (len $items_iter) 0 }} {{ range $items_iter }} {{ if reflect.IsMap . }} {{ $item_name := "" }} {{ $item_icon := "" }} {{ $item_level := "" }} {{ with index . "name" }}{{ $item_name = strings.TrimSpace (printf "%v" .) }}{{ end }} {{ with index . "icon" }}{{ $item_icon = strings.TrimSpace (printf "%v" .) }}{{ end }} {{ with index . "level" }}{{ $item_level = lower (strings.TrimSpace (printf "%v" .)) }}{{ end }} {{ if $item_name }} {{ $items = $items | append (dict "name" $item_name "icon" $item_icon "level" $item_level) }} {{ end }} {{ end }} {{ end }} {{ end }} {{ if gt (len $items) 0 }} {{ $categories = $categories | append (dict "name" $cat_name "items" $items) }} {{ end }} {{ end }} {{ end }} {{ end }}
{{ . | emojify | $page.RenderString }}
{{ end }}