switch to scoped weight system for the course next button (#1964)

This commit is contained in:
trean
2025-10-23 11:18:14 +02:00
committed by GitHub
parent b350cd94b3
commit 630e45e37c
41 changed files with 72 additions and 59 deletions
@@ -1,7 +1,7 @@
--- ---
title: "Day 0: Setup and First Steps" title: "Day 0: Setup and First Steps"
isLesson: true isLesson: true
weight: 1 weight: 10
--- ---
{{< date >}} Day 0 {{< /date >}} {{< date >}} Day 0 {{< /date >}}
@@ -1,7 +1,7 @@
--- ---
title: "Day 1: Vector Search Fundamentals" title: "Day 1: Vector Search Fundamentals"
isLesson: true isLesson: true
weight: 5 weight: 20
--- ---
{{< date >}} Day 1 {{< /date >}} {{< date >}} Day 1 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: Text Chunking Strategies title: Text Chunking Strategies
weight: 8 weight: 4
--- ---
{{< date >}} Day 1 {{< /date >}} {{< date >}} Day 1 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: Distance Metrics title: Distance Metrics
weight: 7 weight: 3
--- ---
{{< date >}} Day 1 {{< /date >}} {{< date >}} Day 1 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: Points, Vectors and Payloads title: Points, Vectors and Payloads
weight: 6 weight: 2
--- ---
{{< date >}} Day 1 {{< /date >}} {{< date >}} Day 1 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: "Demo: Semantic Movie Search" title: "Demo: Semantic Movie Search"
weight: 9 weight: 5
--- ---
{{< date >}} Day 1 {{< /date >}} {{< date >}} Day 1 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: "Project: Building a Semantic Search Engine" title: "Project: Building a Semantic Search Engine"
weight: 10 weight: 6
--- ---
{{< date >}} Day 1 {{< /date >}} {{< date >}} Day 1 {{< /date >}}
@@ -1,7 +1,7 @@
--- ---
title: "Day 2: Indexing and Performance" title: "Day 2: Indexing and Performance"
isLesson: true isLesson: true
weight: 11 weight: 30
--- ---
{{< date >}} Day 2 {{< /date >}} {{< date >}} Day 2 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: "Demo: HNSW Performance Tuning" title: "Demo: HNSW Performance Tuning"
weight: 14 weight: 4
--- ---
{{< date >}} Day 2 {{< /date >}} {{< date >}} Day 2 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: Combining Vector Search and Filtering title: Combining Vector Search and Filtering
weight: 13 weight: 3
--- ---
{{< date >}} Day 2 {{< /date >}} {{< date >}} Day 2 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: "Project: HNSW Performance Benchmarking" title: "Project: HNSW Performance Benchmarking"
weight: 15 weight: 5
--- ---
{{< date >}} Day 2 {{< /date >}} {{< date >}} Day 2 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: HNSW Indexing Fundamentals title: HNSW Indexing Fundamentals
weight: 12 weight: 2
--- ---
{{< date >}} Day 2 {{< /date >}} {{< date >}} Day 2 {{< /date >}}
@@ -1,7 +1,7 @@
--- ---
title: "Day 3: Hybrid Search" title: "Day 3: Hybrid Search"
isLesson: true isLesson: true
weight: 16 weight: 40
--- ---
{{< date >}} Day 3 {{< /date >}} {{< date >}} Day 3 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: "Demo: Implementing a Hybrid Search System" title: "Demo: Implementing a Hybrid Search System"
weight: 20 weight: 5
--- ---
{{< date >}} Day 3 {{< /date >}} {{< date >}} Day 3 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: Hybrid Search and the Universal Query API title: Hybrid Search and the Universal Query API
weight: 19 weight: 4
--- ---
{{< date >}} Day 3 {{< /date >}} {{< date >}} Day 3 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: "Project: Building a Hybrid Search Engine" title: "Project: Building a Hybrid Search Engine"
weight: 21 weight: 6
--- ---
{{< date >}} Day 3 {{< /date >}} {{< date >}} Day 3 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: "Demo: Keyword Search with Sparse Vectors" title: "Demo: Keyword Search with Sparse Vectors"
weight: 18 weight: 3
--- ---
{{< date >}} Day 3 {{< /date >}} {{< date >}} Day 3 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: Sparse Vectors and Inverted Indexes title: Sparse Vectors and Inverted Indexes
weight: 17 weight: 2
--- ---
{{< date >}} Day 3 {{< /date >}} {{< date >}} Day 3 {{< /date >}}
@@ -1,7 +1,7 @@
--- ---
title: "Day 4: Optimization and Scale" title: "Day 4: Optimization and Scale"
isLesson: true isLesson: true
weight: 22 weight: 50
--- ---
{{< date >}} Day 4 {{< /date >}} {{< date >}} Day 4 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: Large-Scale Data Ingestion title: Large-Scale Data Ingestion
weight: 25 weight: 4
--- ---
{{< date >}} Day 4 {{< /date >}} {{< date >}} Day 4 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: "Project: Quantization Performance Optimization" title: "Project: Quantization Performance Optimization"
weight: 26 weight: 5
--- ---
{{< date >}} Day 4 {{< /date >}} {{< date >}} Day 4 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: Accuracy Recovery with Rescoring title: Accuracy Recovery with Rescoring
weight: 24 weight: 3
--- ---
{{< date >}} Day 4 {{< /date >}} {{< date >}} Day 4 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: Vector Quantization Methods title: Vector Quantization Methods
weight: 23 weight: 2
--- ---
{{< date >}} Day 4 {{< /date >}} {{< date >}} Day 4 {{< /date >}}
@@ -1,7 +1,7 @@
--- ---
title: "Day 5: Advanced APIs" title: "Day 5: Advanced APIs"
isLesson: true isLesson: true
weight: 27 weight: 60
--- ---
{{< date >}} Day 5 {{< /date >}} {{< date >}} Day 5 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: Multivectors for Late Interaction Models title: Multivectors for Late Interaction Models
weight: 28 weight: 2
--- ---
{{< date >}} Day 5 {{< /date >}} {{< date >}} Day 5 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: "Project: Building a Recommendation System" title: "Project: Building a Recommendation System"
weight: 31 weight: 5
--- ---
{{< date >}} Day 5 {{< /date >}} {{< date >}} Day 5 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: The Universal Query API title: The Universal Query API
weight: 29 weight: 3
--- ---
{{< date >}} Day 5 {{< /date >}} {{< date >}} Day 5 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: "Demo: Universal Query for Hybrid Retrieval" title: "Demo: Universal Query for Hybrid Retrieval"
weight: 30 weight: 4
--- ---
{{< date >}} Day 5 {{< /date >}} {{< date >}} Day 5 {{< /date >}}
@@ -1,7 +1,7 @@
--- ---
title: "Day 6: Final Project - Building a Production-Grade Search Engine" title: "Day 6: Final Project - Building a Production-Grade Search Engine"
isLesson: true isLesson: true
weight: 32 weight: 70
--- ---
{{< date >}} Day 6 {{< /date >}} {{< date >}} Day 6 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: Course Completion and Next Steps title: Course Completion and Next Steps
weight: 34 weight: 3
--- ---
{{< date >}} Day 6 {{< /date >}} {{< date >}} Day 6 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: "Final Project: Production-Ready Documentation Search Engine" title: "Final Project: Production-Ready Documentation Search Engine"
weight: 33 weight: 2
--- ---
{{< date >}} Day 6 {{< /date >}} {{< date >}} Day 6 {{< /date >}}
@@ -1,7 +1,7 @@
--- ---
title: "Day 7: Partner Ecosystem Integrations (Bonus)" title: "Day 7: Partner Ecosystem Integrations (Bonus)"
isLesson: true isLesson: true
weight: 35 weight: 80
--- ---
{{< date >}} Day 7 {{< /date >}} {{< date >}} Day 7 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: Integrating with Camel AI title: Integrating with Camel AI
weight: 42 weight: 8
--- ---
{{< date >}} Day 7 {{< /date >}} {{< date >}} Day 7 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: Integrating with Haystack title: Integrating with Haystack
weight: 36 weight: 2
--- ---
{{< date >}} Day 7 {{< /date >}} {{< date >}} Day 7 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: Integrating with Jina AI title: Integrating with Jina AI
weight: 43 weight: 9
--- ---
{{< date >}} Day 7 {{< /date >}} {{< date >}} Day 7 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: Integrating with LlamaIndex title: Integrating with LlamaIndex
weight: 40 weight: 6
--- ---
{{< date >}} Day 7 {{< /date >}} {{< date >}} Day 7 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: Integrating with Quotient title: Integrating with Quotient
weight: 41 weight: 7
--- ---
{{< date >}} Day 7 {{< /date >}} {{< date >}} Day 7 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: Integrating with Superlinked title: Integrating with Superlinked
weight: 39 weight: 5
--- ---
{{< date >}} Day 7 {{< /date >}} {{< date >}} Day 7 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: Integrating with Tensorlake title: Integrating with Tensorlake
weight: 38 weight: 4
--- ---
{{< date >}} Day 7 {{< /date >}} {{< date >}} Day 7 {{< /date >}}
@@ -1,6 +1,6 @@
--- ---
title: Integrating with Unstructured.io title: Integrating with Unstructured.io
weight: 37 weight: 3
--- ---
{{< date >}} Day 7 {{< /date >}} {{< date >}} Day 7 {{< /date >}}
@@ -18,9 +18,7 @@
{{ $parent := .Parent }} {{ $parent := .Parent }}
{{ if or (eq .Params.isLesson true) (eq $parent.Params.isLesson true) }} {{ if or (eq .Params.isLesson true) (eq $parent.Params.isLesson true) }}
<div class="d-flex justify-content-lg-end pb-3 pt-4"> <div class="d-flex justify-content-lg-end pb-3 pt-4">
{{ $currentWeight := .Params.weight }} {{/* Determine the course section */}}
{{ $targetWeight := add $currentWeight 1 }}
{{ $subject := "" }} {{ $subject := "" }}
{{ if eq .Params.isLesson true }} {{ if eq .Params.isLesson true }}
{{/* Current page is a lesson (_index.md), parent is the course section */}} {{/* Current page is a lesson (_index.md), parent is the course section */}}
@@ -30,39 +28,54 @@
{{ $subject = .Parent.Parent }} {{ $subject = .Parent.Parent }}
{{ end }} {{ end }}
{{ $allLessons := where $subject.Pages ".Params.isLesson" true }} {{/* Build ordered list: sort lessons by weight, then sort children within each lesson */}}
{{ $allLessons := sort (where $subject.Pages ".Params.isLesson" true) ".Params.weight" }}
{{ $allVideos := slice }} {{ $allPages := slice }}
{{ range $lesson := $allLessons }} {{ range $lesson := $allLessons }}
{{ range $video := $lesson.RegularPages }} {{ $allPages = $allPages | append $lesson }}
{{ $allVideos = $allVideos | append $video }} {{ $sortedChildren := sort $lesson.RegularPages ".Params.weight" }}
{{ range $child := $sortedChildren }}
{{ $allPages = $allPages | append $child }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ $allPages := $allLessons }} {{/* Find current page position in the ordered list */}}
{{ range $p := $allVideos }} {{ $currentPage := . }}
{{ $allPages = $allPages | append $p }} {{ $currentIndex := -1 }}
{{ range $idx, $page := $allPages }}
{{ if eq $page.RelPermalink $currentPage.RelPermalink }}
{{ $currentIndex = $idx }}
{{ end }}
{{ end }} {{ end }}
{{ $nextLesson := where $allPages ".Params.weight" $targetWeight }} {{/* Get next page by index */}}
{{ $nextIndex := add $currentIndex 1 }}
{{ if lt $nextIndex (len $allPages) }}
{{ $next := index $allPages $nextIndex }}
{{ if gt (len $nextLesson) 0 }} {{/* Determine if current page is last in its day (for button text) */}}
{{ $currentPage := . }}
{{ $siblings := $currentPage.Parent.RegularPages }} {{ $siblings := $currentPage.Parent.RegularPages }}
{{ $maxWeight := 0 }} {{ $maxWeight := 0 }}
{{ range $p := $siblings }} {{ range $p := $siblings }}
{{ if gt (int $p.Params.weight) $maxWeight }} {{ $pWeight := 0 }}
{{ $maxWeight = (int $p.Params.weight) }} {{ if $p.Params.weight }}
{{ $pWeight = int $p.Params.weight }}
{{ end }}
{{ if gt $pWeight $maxWeight }}
{{ $maxWeight = $pWeight }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ $next := index $nextLesson 0 }} {{ $currentWeight := 0 }}
{{ if $currentPage.Params.weight }}
{{ $currentWeight = int $currentPage.Params.weight }}
{{ end }}
<a <a
href="{{ $next.RelPermalink }}" href="{{ $next.RelPermalink }}"
class="button button_contained button_sm" class="button button_contained button_sm"
> >
{{ if eq (int $currentPage.Params.weight) $maxWeight }} {{ if eq $currentWeight $maxWeight }}
{{ $subject.Params.content.nextDay }} {{ .Parent.Title }} {{ $subject.Params.content.nextDay }} {{ .Parent.Title }}
{{ else }} {{ else }}
{{ $subject.Params.content.nextButton }} {{ $subject.Params.content.nextButton }}