Files
landing_page/qdrant-landing/themes/qdrant-2024/layouts/partials/course/content-layout.html
T
trean 01bcf8147c Fix course next button + menu upd (#1959)
* fix the next button in the course

* removing course name dependency

* rename the next button

* articles -> learn in the docs menu
2025-10-23 00:50:23 +02:00

85 lines
3.3 KiB
HTML

<!--course content layout, dedicated layout for course pages-->
<section class="docs documentation">
<div class="documentation__container">
<div class="d-flex flex-column flex-xl-row">
{{ partial "course/sidebar-menu.html" (dict "context" .) }}
<div class="documentation__content">
<div class="documentation__content-wrapper">
<div class="documentation__article-wrapper">
{{ if not (eq .RelPermalink "/course/") }}
{{ partial "documentation/breadcrumbs" . }}
{{ end }}
<article class="documentation-article">
{{ partial "article-content.html" . }}
{{ $parent := .Parent }}
{{ if or (eq .Params.isLesson true) (eq $parent.Params.isLesson true) }}
<div class="d-flex justify-content-lg-end pb-3 pt-4">
{{ $currentWeight := .Params.weight }}
{{ $targetWeight := add $currentWeight 1 }}
{{ $subject := "" }}
{{ if eq .Params.isLesson true }}
{{/* Current page is a lesson (_index.md), parent is the course section */}}
{{ $subject = .Parent }}
{{ else }}
{{/* Current page is inside a lesson, grandparent is the course section */}}
{{ $subject = .Parent.Parent }}
{{ end }}
{{ $allLessons := where $subject.Pages ".Params.isLesson" true }}
{{ $allVideos := slice }}
{{ range $lesson := $allLessons }}
{{ range $video := $lesson.RegularPages }}
{{ $allVideos = $allVideos | append $video }}
{{ end }}
{{ end }}
{{ $allPages := $allLessons }}
{{ range $p := $allVideos }}
{{ $allPages = $allPages | append $p }}
{{ end }}
{{ $nextLesson := where $allPages ".Params.weight" $targetWeight }}
{{ if gt (len $nextLesson) 0 }}
{{ $currentPage := . }}
{{ $siblings := $currentPage.Parent.RegularPages }}
{{ $maxWeight := 0 }}
{{ range $p := $siblings }}
{{ if gt (int $p.Params.weight) $maxWeight }}
{{ $maxWeight = (int $p.Params.weight) }}
{{ end }}
{{ end }}
{{ $next := index $nextLesson 0 }}
<a
href="{{ $next.RelPermalink }}"
class="button button_contained button_sm"
>
{{ if eq (int $currentPage.Params.weight) $maxWeight }}
{{ $subject.Params.content.nextDay }} {{ .Parent.Title }}
{{ else }}
{{ $subject.Params.content.nextButton }}
{{ end }}
</a>
{{ end }}
</div>
{{ end }}
</article>
</div>
{{ partial "table-of-contents" . }}
{{ partial "documentation/footer.html" . }}
</div>
</div>
</div>
</div>
</section>