Add Course page (#1844)

* Add Course page

* Added shortcodes and buttons to navigate to the next page

* move course images from layout

* decouple documentation and course layout

* decouple course sidebar

* move accordion js handlers into global unconditional js

* enable search on courses

* allow nested courses

* disable links for now

---------

Co-authored-by: generall <andrey@vasnetsov.com>
This commit is contained in:
nastyapash
2025-08-14 22:42:19 +02:00
committed by GitHub
co-authored by generall
parent cbd9061f6b
commit d758ddcb81
54 changed files with 1069 additions and 63 deletions
@@ -0,0 +1,74 @@
<!--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 := site.GetPage "course" }}
{{ $allLessons := where $subject.Pages ".Params.isLesson" true }}
{{ $allVideos := slice }}
{{ range $lesson := $allLessons }}
{{ $allVideos = $allVideos | append $lesson.RegularPages }}
{{ 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>