mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-11 12:11:45 +00:00
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.
This commit is contained in:
1 parent
752539141a
commit
f019cbac21
11 files changed
+76
-53
No files matched your search
File renamed without changes.
+41
-24
@@ -99,6 +99,37 @@
|
||||
{{ with index . "publications" }}{{ $publications = strings.TrimSpace (printf "%v" .) }}{{ end }}
|
||||
{{ with index . "funding" }}{{ $funding = strings.TrimSpace (printf "%v" .) }}{{ end }}
|
||||
|
||||
{{/* Generic metrics array: [{ icon, value, label }, ...] — first 3 rendered */}}
|
||||
{{ $metrics := slice }}
|
||||
{{ $metrics_raw := index . "metrics" }}
|
||||
{{ if reflect.IsSlice $metrics_raw }}
|
||||
{{ range $metrics_raw }}
|
||||
{{ if reflect.IsMap . }}
|
||||
{{ $m_icon := "" }}
|
||||
{{ $m_value := "" }}
|
||||
{{ $m_label := "" }}
|
||||
{{ with index . "icon" }}{{ $m_icon = printf "%v" . }}{{ end }}
|
||||
{{ with index . "value" }}{{ $m_value = strings.TrimSpace (printf "%v" .) }}{{ end }}
|
||||
{{ with index . "label" }}{{ $m_label = strings.TrimSpace (printf "%v" .) }}{{ end }}
|
||||
{{ if or $m_value $m_label }}
|
||||
{{ $metrics = $metrics | append (dict "icon" $m_icon "value" $m_value "label" $m_label) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{/* Backcompat: synthesise from legacy team_size / publications / funding when `metrics` not provided */}}
|
||||
{{ if not $metrics }}
|
||||
{{ if $team_size }}
|
||||
{{ $metrics = $metrics | append (dict "icon" "hero/user-group" "value" (replaceRE " researchers" "" $team_size) "label" "team") }}
|
||||
{{ end }}
|
||||
{{ if $publications }}
|
||||
{{ $metrics = $metrics | append (dict "icon" "hero/document-text" "value" (replaceRE " papers" "" $publications) "label" "papers") }}
|
||||
{{ end }}
|
||||
{{ if $funding }}
|
||||
{{ $metrics = $metrics | append (dict "icon" "hero/currency-dollar" "value" $funding "label" "funding") }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ $cta_raw := index . "cta" }}
|
||||
{{ if reflect.IsMap $cta_raw }}
|
||||
{{ with index $cta_raw "url" }}{{ $cta_url = strings.TrimSpace (printf "%v" .) }}{{ end }}
|
||||
@@ -107,7 +138,7 @@
|
||||
{{ end }}
|
||||
|
||||
{{ if or $name $description }}
|
||||
{{ $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)) }}
|
||||
{{ $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)) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
@@ -158,9 +189,7 @@
|
||||
{{ $item_url := index $item "url" }}
|
||||
{{ $status := index $item "status" }}
|
||||
{{ $topics := index $item "topics" }}
|
||||
{{ $team_size := index $item "team_size" }}
|
||||
{{ $publications := index $item "publications" }}
|
||||
{{ $funding := index $item "funding" }}
|
||||
{{ $metrics := index $item "metrics" }}
|
||||
{{ $item_cta := index $item "cta" }}
|
||||
{{ $item_cta_url := "" }}
|
||||
{{ $item_cta_text := "" }}
|
||||
@@ -313,28 +342,16 @@
|
||||
|
||||
{{/* Footer Section - Always at bottom */}}
|
||||
<div class="mt-auto">
|
||||
{{/* Stats/Metrics */}}
|
||||
{{ if or $team_size $publications $funding }}
|
||||
{{/* Stats/Metrics — generic icon/value/label, max 3 */}}
|
||||
{{ with $metrics }}
|
||||
<div class="grid grid-cols-3 gap-3 pt-4 border-t border-gray-200 dark:border-gray-700 mb-4">
|
||||
{{ with $team_size }}
|
||||
{{ range first 3 . }}
|
||||
<div class="flex flex-col items-center text-center text-gray-500 dark:text-gray-400">
|
||||
{{ partial "functions/get_icon" (dict "name" "hero/user-group" "attributes" "class=\"w-4 h-4 mx-auto mb-1\"") }}
|
||||
<span class="text-xs leading-tight">{{ . | replaceRE " researchers" "" }}</span>
|
||||
<span class="text-xs text-gray-400">team</span>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ with $publications }}
|
||||
<div class="flex flex-col items-center text-center text-gray-500 dark:text-gray-400">
|
||||
{{ partial "functions/get_icon" (dict "name" "hero/document-text" "attributes" "class=\"w-4 h-4 mx-auto mb-1\"") }}
|
||||
<span class="text-xs leading-tight">{{ . | replaceRE " papers" "" }}</span>
|
||||
<span class="text-xs text-gray-400">papers</span>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ with $funding }}
|
||||
<div class="flex flex-col items-center text-center text-gray-500 dark:text-gray-400">
|
||||
{{ partial "functions/get_icon" (dict "name" "hero/currency-dollar" "attributes" "class=\"w-4 h-4 mx-auto mb-1\"") }}
|
||||
<span class="text-xs leading-tight">{{ . }}</span>
|
||||
<span class="text-xs text-gray-400">funding</span>
|
||||
{{ with index . "icon" }}
|
||||
{{ partial "functions/get_icon" (dict "name" . "attributes" "class=\"w-4 h-4 mx-auto mb-1\"") }}
|
||||
{{ end }}
|
||||
{{ with index . "value" }}<span class="text-xs leading-tight">{{ . }}</span>{{ end }}
|
||||
{{ with index . "label" }}<span class="text-xs text-gray-400">{{ . }}</span>{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"id": "focus-areas",
|
||||
"name": "Focus Areas",
|
||||
"version": "1.1.0",
|
||||
"license": "MIT",
|
||||
"category": "content",
|
||||
"tags": ["focus-areas", "topics", "service-areas", "research-areas", "expertise", "pillars", "programs", "showcase"],
|
||||
"description": "Display focus areas, services, programs, or research themes with rich cards, optional metrics, and multiple layouts (cards, hexagon, timeline)",
|
||||
"author": "Hugo Blox",
|
||||
"homepage": "https://hugoblox.com/blocks/",
|
||||
"repository": "https://github.com/HugoBlox/kit",
|
||||
"keywords": ["hugo", "static-site", "focus-areas", "service-areas", "research-areas", "topics", "expertise"]
|
||||
}
|
||||
File renamed without changes.
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "help-categories",
|
||||
"version": "1",
|
||||
"title": "Help Categories",
|
||||
"description": "Grid of help center / knowledge base category cards",
|
||||
"categories": ["content", "navigation"],
|
||||
"preview": "preview.svg"
|
||||
}
|
||||
File renamed without changes.
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "help-questions",
|
||||
"version": "1",
|
||||
"title": "Help Questions",
|
||||
"description": "Display popular, trending, or featured help center questions",
|
||||
"categories": ["content"],
|
||||
"preview": "preview.svg"
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"name": "knowledge-categories",
|
||||
"version": "1",
|
||||
"title": "Knowledge Categories",
|
||||
"description": "Grid of knowledge base category cards",
|
||||
"categories": ["content", "navigation"],
|
||||
"preview": "preview.svg"
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"id": "research-areas",
|
||||
"name": "Research Areas",
|
||||
"version": "1.0.0",
|
||||
"license": "MIT",
|
||||
"category": "content",
|
||||
"tags": ["research", "areas", "focus", "topics", "science", "lab", "academic", "showcase"],
|
||||
"description": "Display research focus areas with rich visuals, metrics, and interactive layouts",
|
||||
"author": "Hugo Blox",
|
||||
"homepage": "https://hugoblox.com/blocks/",
|
||||
"repository": "https://github.com/HugoBlox/kit",
|
||||
"keywords": ["hugo", "static-site", "research", "areas", "academic", "lab", "science"]
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"name": "trending-questions",
|
||||
"version": "1",
|
||||
"title": "Trending Questions",
|
||||
"description": "Display trending or featured questions",
|
||||
"categories": ["content"],
|
||||
"preview": "preview.svg"
|
||||
}
|
||||
@@ -9,3 +9,9 @@ renames:
|
||||
new: resume-languages
|
||||
- old: skills
|
||||
new: resume-skills
|
||||
- old: research-areas
|
||||
new: focus-areas
|
||||
- old: knowledge-categories
|
||||
new: help-categories
|
||||
- old: trending-questions
|
||||
new: help-questions
|
||||
Reference in new issue
Block a user