binario/layouts/index.html
Vimux 2cf17c04e1
Fix broken homepage on Hugo 0.57+ (#14)
Hugo 0.57 breaks mainSections logic and how the home section works.
Switch to .Site.RegularPages for the home page paginator to restore old
behavior.

Fix #13

See https://github.com/gohugoio/hugoThemes/issues/682,
https://github.com/gohugoio/hugoThemes/issues/678,
https://github.com/gohugoio/hugo/issues/6153
2019-08-17 09:50:33 -04:00

29 lines
No EOL
1.2 KiB
HTML

{{ define "main" }}
<main class="main">
{{- if .Content }}
<div class="page block">
{{ with .Content }}<div class="page__content page__content--notitle">{{ . }}</div>{{ end }}
</div>
{{- end }}
{{- $mainSections := .Site.Params.mainSections }}
{{- $paginator := .Paginate (where .Site.RegularPages "Type" "in" $mainSections) }}
{{- if gt $paginator.TotalNumberOfElements 0 }}
<div class="cards">
{{- range $paginator.Pages }}
<div class="card{{ if and (ge ($.Param "columns") 1) (le ($.Param "columns") 3) }} card--{{ $.Param "columns" }}col{{ else }} card--2col{{ end }}">
{{ .Render "summary" }}
</div>
{{- end }}
</div>
{{- end }}
{{- if and (not .Site.Params.hideNoPostsWarning) (eq $paginator.TotalNumberOfElements 0) }}
<div class="empty block center">
<div class="empty__icon">¯\_(ツ)_/¯</div>
<h3 class="empty__title">{{ T "empty_title" }}</h3>
<p class="empty__text">{{ T "empty_text_start" | safeHTML }} ({{ delimit (apply $mainSections "printf" "<code>content/%s</code>" ".") ", " | safeHTML }}), {{ T "empty_text_end" }}.</p>
<p class="empty__tip">{{ T "empty_tip" | safeHTML }}</p>
</div>
{{- end }}
</main>
{{ partial "pagination.html" . }}
{{ end }}