generated from layer5io/layer5-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #176 from iArchitSharma/nextPage
New feature: A next/previous button for the docs section
- Loading branch information
Showing
8 changed files
with
124 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{{ define "main" }} | ||
{{ .Render "content" }} | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
|
||
{{ $currentNode := . }} | ||
|
||
{{ template "menu-nextprev" dict "menu" .Site.Home "currentnode" $currentNode }} | ||
|
||
{{ define "menu-nextprev" }} | ||
{{$currentNode := .currentnode }} | ||
{{ if ne .menu.Params.hidden true}} | ||
{{if hasPrefix $currentNode.RelPermalink .menu.RelPermalink }} | ||
{{ $currentNode.Scratch.Set "NextPageOK" "OK" }} | ||
{{ $currentNode.Scratch.Set "prevPage" ($currentNode.Scratch.Get "prevPageTmp") }} | ||
{{else}} | ||
{{if eq ($currentNode.Scratch.Get "NextPageOK") "OK"}} | ||
{{ $currentNode.Scratch.Set "NextPageOK" nil }} | ||
{{ $currentNode.Scratch.Set "nextPage" .menu }} | ||
{{end}} | ||
{{end}} | ||
{{ $currentNode.Scratch.Set "prevPageTmp" .menu }} | ||
|
||
{{ $currentNode.Scratch.Set "pages" .menu.Pages }} | ||
{{ if .menu.IsHome}} | ||
{{ $currentNode.Scratch.Set "pages" .menu.Sections }} | ||
{{ else if .menu.Sections}} | ||
{{ $currentNode.Scratch.Set "pages" (.menu.Pages | union .menu.Sections) }} | ||
{{end}} | ||
{{ $pages := ($currentNode.Scratch.Get "pages") }} | ||
|
||
{{ range $pages.ByWeight }} | ||
{{ template "menu-nextprev" dict "menu" . "currentnode" $currentNode }} | ||
{{end}} | ||
{{ end }} | ||
{{ end }} | ||
|
||
<nav class="pagination-nav mt-5" aria-label="Docs pages"> | ||
{{$showPrevNext := (and (not .Params.disableNextPrev) (not .Site.Params.disableNextPrev))}} | ||
{{if $showPrevNext}} | ||
{{with ($.Scratch.Get "prevPage")}} | ||
<a class="pagination-nav__link pagination-nav__link--prev" href="{{.RelPermalink}}"> | ||
<div class="pagination-nav__sublabel">Previous</div> | ||
<div class="pagination-nav__label"><i class="fa fa-chevron-left"></i> {{.Title}}</div> | ||
</a> | ||
{{end}} | ||
{{with ($.Scratch.Get "nextPage")}} | ||
<a class="pagination-nav__link pagination-nav__link--next" href="{{.RelPermalink}}"> | ||
<div class="pagination-nav__sublabel">Next</div> | ||
<div class="pagination-nav__label">{{.Title}} <i class="fa fa-chevron-right"></i></div> | ||
</a> | ||
{{end}} | ||
{{end}} | ||
</nav> |