next-prev-navigator.html 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <div class="row next-prev-navigator">
  2. {{ $currentPage := . }}
  3. {{ range (where site.RegularPages.ByDate "Type" "in" site.Params.mainSections )}}
  4. {{ if eq .RelPermalink $currentPage.RelPermalink }}
  5. {{ if .Next }}
  6. {{ if (in site.Params.mainSections .Next.Type) }}
  7. <div class="col-md-6 previous-article">
  8. <a href="{{.Next.RelPermalink}}" class="btn btn-outline-info">
  9. <span><i class="fas fa-chevron-circle-left"></i> {{ i18n "prev" }}</span>
  10. <br />
  11. <span>{{ .Next.Title }}</span>
  12. </a>
  13. </div>
  14. {{ end }}
  15. {{ end }}
  16. {{ if .Prev }}
  17. {{ if (in site.Params.mainSections .Prev.Type) }}
  18. {{ $columnWidth:="col-md-12" }}
  19. {{ if .Next }}
  20. {{ if (in site.Params.mainSections .Next.Type) }}
  21. {{ $columnWidth = "col-md-6" }}
  22. {{ end }}
  23. {{ end}}
  24. <div class="{{ $columnWidth }} next-article">
  25. <a href="{{ .Prev.RelPermalink }}" class="btn btn-outline-info">
  26. <span>{{ i18n "next" }} <i class="fas fa-chevron-circle-right"></i></span>
  27. <br />
  28. <span>{{ .Prev.Title }}</span>
  29. </a>
  30. </div>
  31. {{ end }}
  32. {{ end }}
  33. {{ end }}
  34. {{ end }}
  35. </div>