Fix next-prev navigator

This commit is contained in:
hossainemruz 2020-06-30 01:30:59 +06:00
parent 2fd315c3d7
commit 5e993f5740
2 changed files with 36 additions and 25 deletions

View file

@ -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 }}

View 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>