Fix next-prev navigator
This commit is contained in:
parent
2fd315c3d7
commit
5e993f5740
2 changed files with 36 additions and 25 deletions
|
@ -44,31 +44,7 @@
|
|||
|
||||
<!---Next and Previous Navigator -->
|
||||
<hr />
|
||||
<div class="row next-prev-navigator">
|
||||
{{ $currentPage := . }}
|
||||
{{ range (where site.RegularPages.ByDate "Type" "in" site.Params.mainSections )}}
|
||||
{{ if eq .RelPermalink $currentPage.RelPermalink }}
|
||||
{{ if in site.Params.mainSections .Next.Type }}
|
||||
<div class="col-md-6 previous-article">
|
||||
<a href="{{.Next.RelPermalink}}" class="btn btn-outline-info">
|
||||
<span><i class="fas fa-chevron-circle-left"></i> Prev</span>
|
||||
<br />
|
||||
<span>{{ .Next.Title }}</span>
|
||||
</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ if in site.Params.mainSections .Prev.Type }}
|
||||
<div class="{{ if in site.Params.mainSections .Next.Type }}col-md-6{{ else }}col-md-12{{ end }} next-article">
|
||||
<a href="{{ .Prev.RelPermalink }}" class="btn btn-outline-info">
|
||||
<span>Next <i class="fas fa-chevron-circle-right"></i></span>
|
||||
<br />
|
||||
<span>{{ .Prev.Title }}</span>
|
||||
</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ partial "next-prev-navigator.html" . }}
|
||||
<hr />
|
||||
<!-- Add Disqus forum -->
|
||||
{{ if .Site.DisqusShortname }}
|
||||
|
|
35
layouts/partials/next-prev-navigator.html
Normal file
35
layouts/partials/next-prev-navigator.html
Normal file
|
@ -0,0 +1,35 @@
|
|||
<div class="row next-prev-navigator">
|
||||
{{ $currentPage := . }}
|
||||
{{ range (where site.RegularPages.ByDate "Type" "in" site.Params.mainSections )}}
|
||||
{{ if eq .RelPermalink $currentPage.RelPermalink }}
|
||||
{{ if .Next }}
|
||||
{{ if (in site.Params.mainSections .Next.Type) }}
|
||||
<div class="col-md-6 previous-article">
|
||||
<a href="{{.Next.RelPermalink}}" class="btn btn-outline-info">
|
||||
<span><i class="fas fa-chevron-circle-left"></i> Prev</span>
|
||||
<br />
|
||||
<span>{{ .Next.Title }}</span>
|
||||
</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ if .Prev }}
|
||||
{{ if (in site.Params.mainSections .Prev.Type) }}
|
||||
{{ $columnWidth:="col-md-12" }}
|
||||
{{ if .Next }}
|
||||
{{ if (in site.Params.mainSections .Next.Type) }}
|
||||
{{ $columnWidth = "col-md-6" }}
|
||||
{{ end }}
|
||||
{{ end}}
|
||||
<div class="{{ $columnWidth }} next-article">
|
||||
<a href="{{ .Prev.RelPermalink }}" class="btn btn-outline-info">
|
||||
<span>Next <i class="fas fa-chevron-circle-right"></i></span>
|
||||
<br />
|
||||
<span>{{ .Prev.Title }}</span>
|
||||
</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue