Skip to content

Commit 6e7d84e

Browse files
committed
pinned LPs setup, awaiting actual pinned LPs
1 parent 94d97ea commit 6e7d84e

9 files changed

Lines changed: 75 additions & 3 deletions

File tree

assets/css/list-pages.css

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,28 @@ ads-card.path-card .learning-path-title-div { /* xs and sm */
224224
font-size: 0.9rem!important;
225225
}
226226

227+
.pinned-featured-label {
228+
color: inherit;
229+
font-weight: 700;
230+
letter-spacing: 0.02em;
231+
}
232+
233+
ads-card.path-card ads-card-content {
234+
position: relative;
235+
}
236+
237+
.pinned-corner-icon {
238+
position: absolute;
239+
top: 12px;
240+
right: 14px;
241+
color: var(--arm-web-safe-orange);
242+
font-size: 0.95rem;
243+
}
244+
245+
html[theme="dark"] .pinned-corner-icon {
246+
color: var(--arm-orange);
247+
}
248+
227249
html[theme="light"] .learning-path-title, html[theme="light"] .basics-title {
228250
color: var(--arm-web-safe-blue);
229251
}

content/learning-paths/automotive/_index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ key_ip:
77
- Cortex-A
88
- Cortex-R
99
maintopic: true
10+
pinned_learning_paths:
1011
subtitle: Build smarter, real-time vehicle software on reliable Arm platforms.
1112
title: Automotive
1213
weight: 4
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
---
2+
pinned_learning_paths:
23
title: Cross Platform
34
---

content/learning-paths/embedded-and-microcontrollers/_index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ key_ip:
88
- Cortex-M
99
- Ethos-U
1010
maintopic: true
11+
pinned_learning_paths:
1112
operatingsystems_filter:
1213
- Android: 2
1314
- Baremetal: 31

content/learning-paths/laptops-and-desktops/_index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ differentiating_info:
66
key_ip:
77
- Cortex-A
88
maintopic: true
9+
pinned_learning_paths:
910
operatingsystems_filter:
1011
- Android: 2
1112
- ChromeOS: 2

content/learning-paths/mobile-graphics-and-gaming/_index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ key_ip:
88
- Immortalis
99
- Mali
1010
maintopic: true
11+
pinned_learning_paths:
1112
operatingsystems_filter:
1213
- Android: 35
1314
- Linux: 36

content/learning-paths/servers-and-cloud-computing/_index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ differentiating_info:
66
key_ip:
77
- Neoverse
88
maintopic: true
9+
pinned_learning_paths:
10+
- nginx_tune
11+
- codec
912
operatingsystems_filter:
1013
- Android: 3
1114
- Linux: 211

themes/arm-design-system-hugo-theme/layouts/learning-paths/list.html

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,38 @@
4848
<!-- Sort using the CalculatedDate -->
4949
{{ $sorted_paths_to_list := sort $blogs "calculated_date" "desc" }}
5050

51+
<!-- Allow category-level pinning via front matter:
52+
pinned_learning_paths:
53+
- /learning-paths/<category>/<path-slug>/
54+
-->
55+
{{ $pinned_paths := default (slice) .Params.pinned_learning_paths }}
56+
{{ $blogs_by_path := dict }}
57+
{{ range $sorted_paths_to_list }}
58+
{{ $path_key := trim .learning_path.RelPermalink "/" }}
59+
{{ $blogs_by_path = merge $blogs_by_path (dict $path_key .) }}
60+
{{ end }}
61+
{{ $pinned_lookup := dict }}
62+
{{ $ordered_paths_to_list := slice }}
63+
{{ range $pinned_paths }}
64+
{{ $raw_pin := trim . "/" }}
65+
{{ $path_key := "" }}
66+
{{ if hasPrefix $raw_pin "learning-paths/" }}
67+
{{ $path_key = $raw_pin }}
68+
{{ else }}
69+
{{ $path_key = printf "learning-paths/%s/%s" $section_title $raw_pin }}
70+
{{ end }}
71+
{{ with index $blogs_by_path $path_key }}
72+
{{ $ordered_paths_to_list = $ordered_paths_to_list | append . }}
73+
{{ $pinned_lookup = merge $pinned_lookup (dict $path_key true) }}
74+
{{ end }}
75+
{{ end }}
76+
{{ range $sorted_paths_to_list }}
77+
{{ $path_key := trim .learning_path.RelPermalink "/" }}
78+
{{ if not (index $pinned_lookup $path_key) }}
79+
{{ $ordered_paths_to_list = $ordered_paths_to_list | append . }}
80+
{{ end }}
81+
{{ end }}
82+
5183
{{/*
5284
{{ range $sorted_paths_to_list }}
5385
<p>{{ .learning_path.Title }}</p>
@@ -103,7 +135,9 @@
103135

104136
<div class="c-col c-col-12">
105137
<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">
106-
{{ range $sorted_paths_to_list }}
138+
{{ range $ordered_paths_to_list }}
139+
{{ $path_key := trim .learning_path.RelPermalink "/" }}
140+
{{ $is_pinned := index $pinned_lookup $path_key }}
107141
<!-- This div assigns tags for each LP for filtering. -->
108142
<div class='path-div search-div gradient-box
109143
{{ with .learning_path.Params.skillLevels }}
@@ -134,7 +168,7 @@
134168
{{ end }}
135169
'>
136170
<!-- Path card formatting -->
137-
{{ partial "general-formatting/path-ads-card.html" (dict "learning_path" .learning_path "calculated_date" .calculated_date) }}
171+
{{ partial "general-formatting/path-ads-card.html" (dict "learning_path" .learning_path "calculated_date" .calculated_date "is_pinned" $is_pinned) }}
138172
</div>
139173
{{ end }}
140174
</div>

themes/arm-design-system-hugo-theme/layouts/partials/general-formatting/path-ads-card.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,17 @@
1212

1313
<ads-card link="{{.learning_path.Permalink}}" class='path-card'>
1414
<ads-card-content slot="content">
15+
{{ if .is_pinned }}
16+
<span class="pinned-corner-icon" aria-label="Pinned learning path" title="Pinned learning path">
17+
<i class="fa-solid fa-thumbtack" aria-hidden="true"></i>
18+
</span>
19+
{{ end }}
1520
<!-- SUBJECT -->
1621
<p class="card-subject u-margin-top-0 u-margin-bottom-1/2">
1722
{{ upper .learning_path.Params.subjects }}
23+
{{ if .is_pinned }}
24+
<span class="pinned-featured-label">&nbsp;| FEATURED</span>
25+
{{ end }}
1826
</p>
1927
<!-- Title of Learning Path -->
2028
<div class="learning-path-title-div">
@@ -37,4 +45,4 @@ <h6 class="search-title learning-path-title">{{.learning_path.Title}}</h6>
3745
&nbsp;<span class="time-to-complete-string" name="{{.learning_path.Params.minutes_to_complete}}">{{partial "server-side-processing/time-beautifier.html" .learning_path.Params.minutes_to_complete}}</span>
3846
</p>
3947
</ads-card-content>
40-
</ads-card>
48+
</ads-card>

0 commit comments

Comments
 (0)