51 lines
2.1 KiB
HTML
51 lines
2.1 KiB
HTML
{{ $page := index $ "page" }}
|
|
|
|
{{ $labelSingular := index $ "labelSingular" }}
|
|
{{ $pageType := index $ "pageType"}}
|
|
|
|
{{ $pagination := index $ "pagination" }}
|
|
{{ $labelPlural := or (index $ "labelPlural") (print $labelSingular "s") }}
|
|
{{ $maximumListSize := or (index $ "maximumListSize") 3 }}
|
|
{{ $viewAllHref := or (index $ "viewAllHref") (print "/" $labelPlural) }}
|
|
|
|
<section class="list">
|
|
<div class="header">
|
|
<h3>Latest {{ $labelPlural | title }}</h3>
|
|
|
|
{{ if index $ "showViewAllButton" }}
|
|
<div class="view-all">
|
|
<a href="{{ $viewAllHref }}">All {{ $labelPlural }}</a>
|
|
</div>
|
|
{{ end }}
|
|
</div>
|
|
<div class="list-items-container">
|
|
<ul class="list-items">
|
|
{{ $entries := (where site.RegularPages "Type" $pageType).ByDate.Reverse }}
|
|
|
|
{{ if $pagination }}
|
|
{{ $paginator := $page.Paginate $entries }}
|
|
{{ range $paginator.Pages }}
|
|
<li class="list-item" data-href="{{ .Permalink }}" role="button">
|
|
<img class="list-item-image" src="//via.placeholder.com/128" alt="{{ index $ "labelSingular" }} Topic">
|
|
<div class="list-item-text">
|
|
<h4 class="list-item-title">{{ .Title }}</h4>
|
|
<span class="list-item-date">{{ .Date.Format "January 2, 2006" }}</span>
|
|
</div>
|
|
</li>
|
|
{{ end }}
|
|
{{ template "_internal/pagination.html" $page }}
|
|
{{ else }}
|
|
{{ range ( first $maximumListSize $entries ) }}
|
|
<li class="list-item" data-href="{{ .Permalink }}" role="button">
|
|
<img class="list-item-image" src="//via.placeholder.com/128" alt="{{ index $ "labelSingular" }} Topic">
|
|
<div class="list-item-text">
|
|
<h4 class="list-item-title">{{ .Title }}</h4>
|
|
<span class="list-item-date">{{ .Date.Format "January 2, 2006" }}</span>
|
|
</div>
|
|
</li>
|
|
{{ end }}
|
|
{{ end }}
|
|
</ul>
|
|
</div>
|
|
</section>
|