Skip to content

Commit 20b44f2

Browse files
committed
feat(related-content): Improve related content linking
1 parent 3feb765 commit 20b44f2

File tree

2 files changed

+24
-20
lines changed

2 files changed

+24
-20
lines changed

content/neuromorphic-computing/software/snn-frameworks/nestml/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ supports_NIR: False
1414
language: Python
1515
maintainer: Charl Linssen
1616
draft: false
17+
software_tags: ["nest", 'genn']
18+
hardware_tags: ["spinnaker-2-university-of-dresden"]
1719
---
1820

1921

layouts/partials/shared/related-content.html

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@
66
{{ if $page_context.File }}
77
{{ $current_slug = path.Base $page_context.File.Dir }}
88
{{ end }}
9-
{{ $current_title := $page_context.Title }}
10-
11-
12-
{{/* --- Part 1: Find related content (blog, events) that tag this page --- */}}
139

10+
{{/* --- Part 1: Find INCOMING links from other content (blog, events, etc.) --- */}}
1411
{{ $tag_param_key := "" }}
1512
{{ if eq $current_type "neuromorphic-hardware" }}
1613
{{ $tag_param_key = ".Params.hardware_tags" }}
@@ -25,33 +22,40 @@
2522
{{ end }}
2623
{{ end }}
2724

25+
{{/* --- Part 2: Find OUTGOING links to other hardware/software --- */}}
2826

29-
{{/* --- Part 2: Find related hardware/software (bidirectional linking) --- */}}
30-
31-
{{ if eq $current_type "neuromorphic-hardware" }}
32-
{{/* I am a hardware page. Find software I support using my `software_tags` */}}
33-
{{ with .Params.software_tags }}
34-
{{ $software_slugs_to_find := . }}
35-
{{ $all_software_pages := where site.RegularPages "Type" "neuromorphic-software" }}
36-
{{ range $software_page := $all_software_pages }}
27+
{{/* Find software this page links to */}}
28+
{{ with .Params.software_tags }}
29+
{{ $software_slugs_to_find := . }}
30+
{{ $all_software_pages := where site.RegularPages "Type" "neuromorphic-software" }}
31+
{{ range $software_page := $all_software_pages }}
32+
{{ if ne $software_page.Permalink $page_context.Permalink }}
3733
{{ $software_slug := "" }}
3834
{{ if $software_page.File }}{{ $software_slug = path.Base $software_page.File.Dir }}{{ end }}
3935
{{ if and (ne $software_slug "") (in $software_slugs_to_find $software_slug) }}
4036
{{ $related_items = $related_items | append $software_page }}
4137
{{ end }}
4238
{{ end }}
4339
{{ end }}
40+
{{ end }}
4441

45-
{{ else if and (eq $current_type "neuromorphic-software") (ne $current_slug "") }}
46-
{{/* I am a software page. Find hardware that supports me. */}}
47-
{{ $hardware_pages := where site.RegularPages "Type" "neuromorphic-hardware" }}
48-
{{ range where $hardware_pages ".Params.software_tags" "intersect" (slice $current_slug) }}
49-
{{ $related_items = $related_items | append . }}
42+
{{/* Find hardware this page links to */}}
43+
{{ with .Params.hardware_tags }}
44+
{{ $hardware_slugs_to_find := . }}
45+
{{ $all_hardware_pages := where site.RegularPages "Type" "neuromorphic-hardware" }}
46+
{{ range $hardware_page := $all_hardware_pages }}
47+
{{ if ne $hardware_page.Permalink $page_context.Permalink }}
48+
{{ $hardware_slug := "" }}
49+
{{ if $hardware_page.File }}{{ $hardware_slug = path.Base $hardware_page.File.Dir }}{{ end }}
50+
{{ if and (ne $hardware_slug "") (in $hardware_slugs_to_find $hardware_slug) }}
51+
{{ $related_items = $related_items | append $hardware_page }}
52+
{{ end }}
53+
{{ end }}
5054
{{ end }}
5155
{{ end }}
5256

57+
5358
{{/* --- Finalize and Render --- */}}
54-
{{/* Deduplicate */}}
5559
{{ $unique_related_items := slice }}
5660
{{ $seen_permalinks := slice }}
5761
{{ range $related_items }}
@@ -72,7 +76,6 @@ <h2 class="text-3xl font-bold mb-8">Related Content, Events & Resources</h2>
7276
<div class="timeline-item-content">
7377
<div class="flex flex-col md:flex-row items-start gap-5">
7478

75-
{{/* Thumbnail Column - Renders only if image is in front matter */}}
7679
{{ with $item.Params.image }}
7780
<div class="flex-shrink-0 w-full md:w-40 text-center">
7881
<a href="{{ $item.RelPermalink }}">
@@ -98,7 +101,6 @@ <h2 class="text-3xl font-bold mb-8">Related Content, Events & Resources</h2>
98101
</div>
99102
{{ end }}
100103

101-
{{/* Content Column */}}
102104
<div class="flex-grow">
103105
<div class="flex justify-between items-start gap-4">
104106
<div>

0 commit comments

Comments
 (0)