{{- $wcPage := .wcPage -}} {{- $wcBlock := .wcBlock -}} {{- $wcIdentifier := .wcIdentifier -}} {{- $content := $wcBlock.content -}} {{- if not (reflect.IsMap $content) }}{{ $content = dict }}{{ end -}} {{- $design := $wcBlock.design -}} {{- if not (reflect.IsMap $design) }}{{ $design = dict }}{{ end -}} {{- $st := index $design "spacing" -}} {{- if not (reflect.IsMap $st) }}{{ $st = dict }}{{ end -}} {{- $pad := slice "4rem" "0" "4rem" "0" -}} {{- $pad_raw := index $st "padding" -}} {{- if and (reflect.IsSlice $pad_raw) (ge (len $pad_raw) 4) }}{{ $pad = $pad_raw }}{{ end -}} {{- $title := "" -}} {{- $title_raw := index $content "title" -}} {{- if eq (printf "%T" $title_raw) "string" }}{{ $title = $title_raw }}{{ end -}} {{- $subtitle := "" -}} {{- $subtitle_raw := index $content "subtitle" -}} {{- if eq (printf "%T" $subtitle_raw) "string" }}{{ $subtitle = $subtitle_raw }}{{ end -}} {{- $categories_raw := index $content "categories" -}} {{- $categories := slice -}} {{- if reflect.IsSlice $categories_raw }}{{ $categories = $categories_raw }}{{ end -}} {{- $view_all := index $content "view_all" -}} {{- if not (reflect.IsMap $view_all) }}{{ $view_all = dict }}{{ end -}} {{- $view_all_text := "" -}} {{- with index $view_all "text" }}{{ $view_all_text = strings.TrimSpace (printf "%v" .) }}{{ end -}} {{- $view_all_link := "" -}} {{- with index $view_all "link" }}{{ $view_all_link = strings.TrimSpace (printf "%v" .) }}{{ end -}}
{{/* Section header */}} {{ if or $title $subtitle }}
{{ with $title }}

{{ . | markdownify }}

{{ end }} {{ with $subtitle }}

{{ . | markdownify }}

{{ end }}
{{ end }} {{/* Categories grid - with dynamic counts from Hugo taxonomy */}}
{{ range $categories }} {{ if reflect.IsMap . }} {{ $category_name := "" }} {{ $category_raw := index . "category" | default (index . "title") }} {{ if ne $category_raw nil }}{{ $category_name = strings.TrimSpace (printf "%v" $category_raw) }}{{ end }} {{/* Get actual count from Hugo taxonomy - proper Hugo syntax */}} {{ $category_url := "" }} {{ $actual_count := 0 }} {{ if $category_name }} {{ with site.Taxonomies.categories.Get $category_name }} {{ $actual_count = .Count }} {{ $category_url = .Page.RelPermalink }} {{ end }} {{ end }} {{ $manual_count := partial "functions/coerce_int" (dict "value" (index . "count") "default" 0 "min" 0) }} {{ $item_link := "" }} {{ $link_raw := index . "link" }} {{ if eq (printf "%T" $link_raw) "string" }}{{ $item_link = strings.TrimSpace $link_raw }}{{ end }} {{ if not $item_link }}{{ $item_link = $category_url }}{{ end }} {{/* Only show category if it has content OR if count is explicitly set */}} {{ if or (gt $actual_count 0) (gt $manual_count 0) }} {{ if $item_link }} {{ $link := $item_link }} {{ $scheme := (urls.Parse $link).Scheme }} {{ if not $scheme }} {{ if not (hasPrefix $link "#") }} {{ $link = $link | relLangURL }} {{ end }} {{ end }} {{ else }} {{ end }} {{ end }} {{ end }} {{ end }}
{{/* View all link */}} {{ if and $view_all_text $view_all_link }} {{ $link := $view_all_link }} {{ $scheme := (urls.Parse $link).Scheme }} {{ if not $scheme }} {{ if not (hasPrefix $link "#") }} {{ $link = $link | relLangURL }} {{ end }} {{ end }} {{ end }}