Files
Custom-Static-Website-Gener…/sample-hugo-template/Tech-Club-Blog/layouts/partials/articles/list.html
2020-05-10 20:47:17 +04:00

55 lines
2.3 KiB
HTML

<section class="section nartrow">
<div id="articlesList" class="articles-list-container show-details">
{{ $posts := partialCached "func/GetArticles" . "articles" }}
{{ $paginator := .Paginate $posts }}
{{ $biggerFirst := true }}
{{ $biggerPlaced := false }}
{{ range $index, $article := $paginator.Pages }}
{{ $counter := mod $index 2 }}
{{ if not $counter }}
<div class="post-row">
{{ end }}
<a href="{{ $article.RelPermalink }}" class="article-link"
{{ if and (eq ($biggerFirst) true) (eq ($biggerPlaced) false) }}
{{ if eq $counter 0 }}
id="article-link-bigger"
{{ $biggerPlaced = true }}
{{ end }}
{{ else if and (not $biggerFirst) (not $biggerPlaced) }}
{{ if ne $counter 0 }}
id="article-link-bigger"
{{ $biggerPlaced = true }}
{{ end }}
{{ end }}>
<div class="article-data-outer">
<div class="image-container">
<img src="{{ $article.Params.hero }}" class="article-image" />
</div>
<div class="article-data">
<h2 class="article-title">
{{ $article.Params.title }}
</h2>
<p class="article-excerpt">
{{ $article.Params.excerpt }}
</p>
<div class="article-metadata">
{{ $article.Date.Format "January 2, 2006" }}{{ if $article.Params.timetoread }} • {{ $article.Params.timetoread }} min read{{ end }}
</div>
</div>
</div>
</a>
{{ $counter := mod (add $index 1) 2 }}
{{ $len := (where .Pages "Type" "posts") }}
{{ if or (eq $counter 0) (eq (add $index 1) $len) }}
</div>
{{ $biggerPlaced = false }}
{{ if $biggerFirst }}
{{ $biggerFirst = false }}
{{ else }}
{{ $biggerFirst = true }}
{{ end }}
{{ end }}
{{ end }}
</div>
{{ partial "paginator/paginator.html" . }}
</section>