mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-03 09:58:30 +02:00
98 lines
4.1 KiB
HTML
98 lines
4.1 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">
|
|
{{/* Determine the course section */}}
|
|
{{ $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 }}
|
|
|
|
{{/* Build ordered list: sort lessons by weight, then sort children within each lesson */}}
|
|
{{ $allLessons := sort (where $subject.Pages ".Params.isLesson" true) ".Params.weight" }}
|
|
{{ $allPages := slice }}
|
|
{{ range $lesson := $allLessons }}
|
|
{{ $allPages = $allPages | append $lesson }}
|
|
{{ $sortedChildren := sort $lesson.RegularPages ".Params.weight" }}
|
|
{{ range $child := $sortedChildren }}
|
|
{{ $allPages = $allPages | append $child }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{/* Find current page position in the ordered list */}}
|
|
{{ $currentPage := . }}
|
|
{{ $currentIndex := -1 }}
|
|
{{ range $idx, $page := $allPages }}
|
|
{{ if eq $page.RelPermalink $currentPage.RelPermalink }}
|
|
{{ $currentIndex = $idx }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{/* Get next page by index */}}
|
|
{{ $nextIndex := add $currentIndex 1 }}
|
|
{{ if lt $nextIndex (len $allPages) }}
|
|
{{ $next := index $allPages $nextIndex }}
|
|
|
|
{{/* Determine if current page is last in its day (for button text) */}}
|
|
{{ $siblings := $currentPage.Parent.RegularPages }}
|
|
{{ $maxWeight := 0 }}
|
|
{{ range $p := $siblings }}
|
|
{{ $pWeight := 0 }}
|
|
{{ if $p.Params.weight }}
|
|
{{ $pWeight = int $p.Params.weight }}
|
|
{{ end }}
|
|
{{ if gt $pWeight $maxWeight }}
|
|
{{ $maxWeight = $pWeight }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ $currentWeight := 0 }}
|
|
{{ if $currentPage.Params.weight }}
|
|
{{ $currentWeight = int $currentPage.Params.weight }}
|
|
{{ end }}
|
|
|
|
<a
|
|
href="{{ $next.RelPermalink }}"
|
|
class="button button_contained button_sm"
|
|
>
|
|
{{ if eq $currentWeight $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>
|