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 /> <hr />
<div class="row next-prev-navigator"> <div class="row next-prev-navigator">
{{ $currentPage := . }} {{ $currentPage := . }}
{{ range .Site.RegularPages.ByDate }} {{ range (where site.RegularPages.ByDate "Type" "in" site.Params.mainSections )}}
{{ if eq .RelPermalink $currentPage.RelPermalink }} {{ if eq .RelPermalink $currentPage.RelPermalink }}
{{ if .Next }} {{ if in site.Params.mainSections .Next.Type }}
<div class="col-md-6 previous-article"> <div class="col-md-6 previous-article">
<a href="{{.Next.RelPermalink}}" class="btn btn-outline-info"> <a href="{{.Next.RelPermalink}}" class="btn btn-outline-info">
<span><i class="fas fa-chevron-circle-left"></i> Prev</span> <span><i class="fas fa-chevron-circle-left"></i> Prev</span>
@ -57,8 +57,8 @@
</a> </a>
</div> </div>
{{ end }} {{ end }}
{{ if .Prev }} {{ if in site.Params.mainSections .Prev.Type }}
<div class="{{ if .Next }}col-md-6{{ else }}col-md-12{{ end }} next-article"> <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"> <a href="{{ .Prev.RelPermalink }}" class="btn btn-outline-info">
<span>Next <i class="fas fa-chevron-circle-right"></i></span> <span>Next <i class="fas fa-chevron-circle-right"></i></span>
<br /> <br />

View file

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