Skip to content

Commit f019cba

Browse files
committed
refactor(blox): namespace vertical-locked blocks; generalise focus-areas
- research-areas β†’ focus-areas (general scope: services, programs, research themes, expertise). Metric fields refactored from hardcoded team_size/publications/funding into a generic `metrics: [{icon, value, label}]` array; legacy fields kept as a backcompat fallback so existing content renders identically. - knowledge-categories β†’ help-categories - trending-questions β†’ help-questions The `help-` prefix matches public-facing help-center conventions and mirrors the existing `resume-` namespace pattern for vertical-locked blocks. Aliases in data/blox_aliases.yaml preserve backwards compatibility - templates keep working without content edits.
1 parent 7525391 commit f019cba

11 files changed

Lines changed: 76 additions & 53 deletions

File tree

File renamed without changes.

modules/blox/blox/research-areas/block.html renamed to modules/blox/blox/focus-areas/block.html

Lines changed: 41 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,37 @@
9999
{{ with index . "publications" }}{{ $publications = strings.TrimSpace (printf "%v" .) }}{{ end }}
100100
{{ with index . "funding" }}{{ $funding = strings.TrimSpace (printf "%v" .) }}{{ end }}
101101

102+
{{/* Generic metrics array: [{ icon, value, label }, ...] β€” first 3 rendered */}}
103+
{{ $metrics := slice }}
104+
{{ $metrics_raw := index . "metrics" }}
105+
{{ if reflect.IsSlice $metrics_raw }}
106+
{{ range $metrics_raw }}
107+
{{ if reflect.IsMap . }}
108+
{{ $m_icon := "" }}
109+
{{ $m_value := "" }}
110+
{{ $m_label := "" }}
111+
{{ with index . "icon" }}{{ $m_icon = printf "%v" . }}{{ end }}
112+
{{ with index . "value" }}{{ $m_value = strings.TrimSpace (printf "%v" .) }}{{ end }}
113+
{{ with index . "label" }}{{ $m_label = strings.TrimSpace (printf "%v" .) }}{{ end }}
114+
{{ if or $m_value $m_label }}
115+
{{ $metrics = $metrics | append (dict "icon" $m_icon "value" $m_value "label" $m_label) }}
116+
{{ end }}
117+
{{ end }}
118+
{{ end }}
119+
{{ end }}
120+
{{/* Backcompat: synthesise from legacy team_size / publications / funding when `metrics` not provided */}}
121+
{{ if not $metrics }}
122+
{{ if $team_size }}
123+
{{ $metrics = $metrics | append (dict "icon" "hero/user-group" "value" (replaceRE " researchers" "" $team_size) "label" "team") }}
124+
{{ end }}
125+
{{ if $publications }}
126+
{{ $metrics = $metrics | append (dict "icon" "hero/document-text" "value" (replaceRE " papers" "" $publications) "label" "papers") }}
127+
{{ end }}
128+
{{ if $funding }}
129+
{{ $metrics = $metrics | append (dict "icon" "hero/currency-dollar" "value" $funding "label" "funding") }}
130+
{{ end }}
131+
{{ end }}
132+
102133
{{ $cta_raw := index . "cta" }}
103134
{{ if reflect.IsMap $cta_raw }}
104135
{{ with index $cta_raw "url" }}{{ $cta_url = strings.TrimSpace (printf "%v" .) }}{{ end }}
@@ -107,7 +138,7 @@
107138
{{ end }}
108139

109140
{{ if or $name $description }}
110-
{{ $items = $items | append (dict "name" $name "description" $description "icon" $icon "image" $image "gradient" $gradient "url" $url "status" $status "topics" $topics "team_size" $team_size "publications" $publications "funding" $funding "cta" (dict "url" $cta_url "text" $cta_text "icon" $cta_icon)) }}
141+
{{ $items = $items | append (dict "name" $name "description" $description "icon" $icon "image" $image "gradient" $gradient "url" $url "status" $status "topics" $topics "metrics" $metrics "team_size" $team_size "publications" $publications "funding" $funding "cta" (dict "url" $cta_url "text" $cta_text "icon" $cta_icon)) }}
111142
{{ end }}
112143
{{ end }}
113144
{{ end }}
@@ -158,9 +189,7 @@ <h2 class="text-3xl sm:text-4xl lg:text-5xl font-bold text-gray-900 dark:text-wh
158189
{{ $item_url := index $item "url" }}
159190
{{ $status := index $item "status" }}
160191
{{ $topics := index $item "topics" }}
161-
{{ $team_size := index $item "team_size" }}
162-
{{ $publications := index $item "publications" }}
163-
{{ $funding := index $item "funding" }}
192+
{{ $metrics := index $item "metrics" }}
164193
{{ $item_cta := index $item "cta" }}
165194
{{ $item_cta_url := "" }}
166195
{{ $item_cta_text := "" }}
@@ -313,28 +342,16 @@ <h3 class="text-xl font-bold text-gray-900 dark:text-white mb-3">
313342

314343
{{/* Footer Section - Always at bottom */}}
315344
<div class="mt-auto">
316-
{{/* Stats/Metrics */}}
317-
{{ if or $team_size $publications $funding }}
345+
{{/* Stats/Metrics β€” generic icon/value/label, max 3 */}}
346+
{{ with $metrics }}
318347
<div class="grid grid-cols-3 gap-3 pt-4 border-t border-gray-200 dark:border-gray-700 mb-4">
319-
{{ with $team_size }}
320-
<div class="flex flex-col items-center text-center text-gray-500 dark:text-gray-400">
321-
{{ partial "functions/get_icon" (dict "name" "hero/user-group" "attributes" "class=\"w-4 h-4 mx-auto mb-1\"") }}
322-
<span class="text-xs leading-tight">{{ . | replaceRE " researchers" "" }}</span>
323-
<span class="text-xs text-gray-400">team</span>
324-
</div>
325-
{{ end }}
326-
{{ with $publications }}
327-
<div class="flex flex-col items-center text-center text-gray-500 dark:text-gray-400">
328-
{{ partial "functions/get_icon" (dict "name" "hero/document-text" "attributes" "class=\"w-4 h-4 mx-auto mb-1\"") }}
329-
<span class="text-xs leading-tight">{{ . | replaceRE " papers" "" }}</span>
330-
<span class="text-xs text-gray-400">papers</span>
331-
</div>
332-
{{ end }}
333-
{{ with $funding }}
348+
{{ range first 3 . }}
334349
<div class="flex flex-col items-center text-center text-gray-500 dark:text-gray-400">
335-
{{ partial "functions/get_icon" (dict "name" "hero/currency-dollar" "attributes" "class=\"w-4 h-4 mx-auto mb-1\"") }}
336-
<span class="text-xs leading-tight">{{ . }}</span>
337-
<span class="text-xs text-gray-400">funding</span>
350+
{{ with index . "icon" }}
351+
{{ partial "functions/get_icon" (dict "name" . "attributes" "class=\"w-4 h-4 mx-auto mb-1\"") }}
352+
{{ end }}
353+
{{ with index . "value" }}<span class="text-xs leading-tight">{{ . }}</span>{{ end }}
354+
{{ with index . "label" }}<span class="text-xs text-gray-400">{{ . }}</span>{{ end }}
338355
</div>
339356
{{ end }}
340357
</div>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"id": "focus-areas",
3+
"name": "Focus Areas",
4+
"version": "1.1.0",
5+
"license": "MIT",
6+
"category": "content",
7+
"tags": ["focus-areas", "topics", "service-areas", "research-areas", "expertise", "pillars", "programs", "showcase"],
8+
"description": "Display focus areas, services, programs, or research themes with rich cards, optional metrics, and multiple layouts (cards, hexagon, timeline)",
9+
"author": "Hugo Blox",
10+
"homepage": "https://hugoblox.com/blocks/",
11+
"repository": "https://github.com/HugoBlox/kit",
12+
"keywords": ["hugo", "static-site", "focus-areas", "service-areas", "research-areas", "topics", "expertise"]
13+
}
File renamed without changes.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "help-categories",
3+
"version": "1",
4+
"title": "Help Categories",
5+
"description": "Grid of help center / knowledge base category cards",
6+
"categories": ["content", "navigation"],
7+
"preview": "preview.svg"
8+
}
File renamed without changes.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "help-questions",
3+
"version": "1",
4+
"title": "Help Questions",
5+
"description": "Display popular, trending, or featured help center questions",
6+
"categories": ["content"],
7+
"preview": "preview.svg"
8+
}

β€Žmodules/blox/blox/knowledge-categories/manifest.jsonβ€Ž

Lines changed: 0 additions & 8 deletions
This file was deleted.

β€Žmodules/blox/blox/research-areas/manifest.jsonβ€Ž

Lines changed: 0 additions & 13 deletions
This file was deleted.

β€Žmodules/blox/blox/trending-questions/manifest.jsonβ€Ž

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
Β (0)