Add a guided flow to the workshop
Closed this issue · 0 comments
AnEmortalKid commented
Add some sort of navigation to the workshop that leads to the next page, the pages are sorted by weight already but that won't guarantee someone will know where to go next, something like this should work:
{{/*
Iterates over the set of pages in the current section, locating the current page and creating a link with the contents of the next page.
*/}}
{{ $scratch := newScratch }}
{{ range $index, $element := $.Page.CurrentSection.Pages.ByWeight }}
{{ if (eq $.Page.Params.weight .Params.weight) }}
{{ $scratch.Set "nextIndex" (add 1 $index)}}
{{ end }}
{{ end }}
{{ with index $.Page.CurrentSection.Pages.ByWeight ($scratch.Get "nextIndex") }}
<div class="card mb-3" style="width: 80%;">
<div class="card-header text-white border-info bg-info">
<i class="fas fa-arrow-alt-circle-right"></i> Up Next</div>
<div class="card-body">
<p class="card-text">{{ $.Inner }}</p>
<a href="{{ .Permalink }}">{{ .Params.title | humanize | title }}</a></i>
</div>
</div>
{{ end}}