Skip to content

Commit 652bc52

Browse files
committed
add css and feature to term.html for AI group
1 parent 4e134dd commit 652bc52

2 files changed

Lines changed: 58 additions & 4 deletions

File tree

content/subjects/ml/_index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: AI
3+
slug: ml
4+
pinned_learning_paths:
5+
- learning-paths/cross-platform/kleidiai-explainer
6+
- learning-paths/servers-and-cloud-computing/vllm-acceleration
7+
- learning-paths/laptops-and-desktops/pytorch-finetuning-on-spark
8+
---

themes/arm-design-system-hugo-theme/layouts/_default/term.html

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,50 @@
4040
<!-- Sort using the CalculatedDate -->
4141
{{ $sorted_paths_to_list := sort $blogs "calculated_date" "desc" }}
4242

43+
<!-- Allow taxonomy term pages to pin learning paths via term front matter.
44+
Hugo does not expose term bundle front matter on .Params here, so resolve it explicitly.
45+
Example: content/subjects/ml/_index.md
46+
-->
47+
{{ $term_content_page := site.GetPage (printf "/%s/%s" .Data.Plural (.Data.Term | urlize)) }}
48+
{{ $pinned_paths := default (slice) .Params.pinned_learning_paths }}
49+
{{ with $term_content_page }}
50+
{{ $pinned_paths = default $pinned_paths .Params.pinned_learning_paths }}
51+
{{ end }}
52+
{{ $blogs_by_path := dict }}
53+
{{ $blogs_by_slug := dict }}
54+
{{ $slug_counts := dict }}
55+
{{ range $sorted_paths_to_list }}
56+
{{ $path_key := trim .learning_path.RelPermalink "/" }}
57+
{{ $slug_key := replaceRE "^.*/" "" $path_key }}
58+
{{ $blogs_by_path = merge $blogs_by_path (dict $path_key .) }}
59+
{{ $blogs_by_slug = merge $blogs_by_slug (dict $slug_key .) }}
60+
{{ $slug_count := default 0 (index $slug_counts $slug_key) }}
61+
{{ $slug_counts = merge $slug_counts (dict $slug_key (add $slug_count 1)) }}
62+
{{ end }}
63+
{{ $pinned_lookup := dict }}
64+
{{ $ordered_paths_to_list := slice }}
65+
{{ range $pinned_paths }}
66+
{{ $raw_pin := trim . "/" }}
67+
{{ $path_key := "" }}
68+
{{ if hasPrefix $raw_pin "learning-paths/" }}
69+
{{ $path_key = $raw_pin }}
70+
{{ else if eq (default 0 (index $slug_counts $raw_pin)) 1 }}
71+
{{ with index $blogs_by_slug $raw_pin }}
72+
{{ $path_key = trim .learning_path.RelPermalink "/" }}
73+
{{ end }}
74+
{{ end }}
75+
{{ with and $path_key (index $blogs_by_path $path_key) }}
76+
{{ $ordered_paths_to_list = $ordered_paths_to_list | append . }}
77+
{{ $pinned_lookup = merge $pinned_lookup (dict $path_key true) }}
78+
{{ end }}
79+
{{ end }}
80+
{{ range $sorted_paths_to_list }}
81+
{{ $path_key := trim .learning_path.RelPermalink "/" }}
82+
{{ if not (index $pinned_lookup $path_key) }}
83+
{{ $ordered_paths_to_list = $ordered_paths_to_list | append . }}
84+
{{ end }}
85+
{{ end }}
86+
4387

4488

4589
<!-- Hugo crawl over learning path directories and display the main categories -->
@@ -83,9 +127,11 @@ <h3 class="u-margin-top-0">Filter</h3>
83127

84128
<div class="c-col c-col-12">
85129
<div id='path-container' class="u-display-grid u-gap-1 sm:u-grid-columns-1 md:u-grid-columns-2 xl:u-grid-columns-2 xxl:u-grid-columns-3 u-margin-top-1">
86-
{{ range $sorted_paths_to_list }}
130+
{{ range $ordered_paths_to_list }}
131+
{{ $path_key := trim .learning_path.RelPermalink "/" }}
132+
{{ $is_pinned := index $pinned_lookup $path_key }}
87133
<!-- This div assigns a category tag for each LP for filtering (cross platform need to iterate over the shared_between var) -->
88-
<div class='path-div search-div
134+
<div class='path-div search-div gradient-box
89135
{{if eq .learning_path.Parent.Title "Cross Platform"}}
90136
{{ with .learning_path.Params.shared_between }}
91137
{{ range .}}
@@ -96,7 +142,7 @@ <h3 class="u-margin-top-0">Filter</h3>
96142
tag-{{.learning_path.Parent.Title | urlize}}
97143
{{end}}'>
98144
<!-- Path card formatting -->
99-
{{ partial "general-formatting/path-ads-card.html" (dict "learning_path" .learning_path "calculated_date" .calculated_date) }}
145+
{{ partial "general-formatting/path-ads-card.html" (dict "learning_path" .learning_path "calculated_date" .calculated_date "is_pinned" $is_pinned) }}
100146
</div>
101147
{{ end }}
102148
</div>
@@ -105,4 +151,4 @@ <h3 class="u-margin-top-0">Filter</h3>
105151
</div>
106152
</div>
107153

108-
{{ end }}
154+
{{ end }}

0 commit comments

Comments
 (0)