Fix navbar issue when no section is configured + fix next-prev navigator

This commit is contained in:
hossainemruz 2020-06-30 00:38:40 +06:00
parent 9a95163b7d
commit b783f11318
2 changed files with 12 additions and 10 deletions

View file

@ -46,9 +46,9 @@
<hr />
<div class="row next-prev-navigator">
{{ $currentPage := . }}
{{ range .Site.RegularPages.ByDate }}
{{ 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>
@ -57,8 +57,8 @@
</a>
</div>
{{ end }}
{{ if .Prev }}
<div class="{{ if .Next }}col-md-6{{ else }}col-md-12{{ end }} next-article">
{{ 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 />

View file

@ -19,12 +19,14 @@
<li class="nav-item">
<a class="nav-link smooth-scroll" href="#home">Home</a>
</li>
{{- range sort .Site.Data.sections "section.weight" }}
{{ if .section.showOnNavbar }}
<li class="nav-item">
<a class="nav-link smooth-scroll" href="#{{ replace (lower .section.name) " " "-" }}">{{ .section.name }}</a>
</li>
{{ end }}
{{- if .Site.Data.sections }}
{{- range sort .Site.Data.sections "section.weight" }}
{{ if .section.showOnNavbar }}
<li class="nav-item">
<a class="nav-link smooth-scroll" href="#{{ replace (lower .section.name) " " "-" }}">{{ .section.name }}</a>
</li>
{{ end }}
{{- end }}
{{- end }}
{{ $hasCustomMenus:= false }}
{{ if and site.Params.customMenus }}