drm-pt.info/layouts/index.html

90 lines
2.6 KiB
HTML
Raw Normal View History

{{ define "main" }}
{{ $articles := (where .Site.RegularPages "Params.carrousel" true) }}
{{ $len := len $articles }}
<div class='carrousel'>
{{ range $index, $article := $articles }}
<input class='carrousel-control' type='radio' name='carrousel' id='v{{ $index }}' {{ if (eq $index 0) }}checked{{ end }} />
{{ end }}
<div class='carrousel-controls'>
{{ range $index, $article := $articles }}
<label class='carrousel-visible-control' for="v{{ $index }}"></label>
{{ end }}
</div>
<ul>
{{ range $index, $article := $articles }}
{{ with $article }}
<li class="item item{{ $index }}">
{{ $cover := (index (.Resources.ByType "image") 0) }}
<a href="{{ .Permalink }}">
<img src="{{ $cover.Permalink }}" alt="" />
{{ $next := (mod (add $index 1) $len) }}
{{ $prev := (mod (add $index $len -1) $len) }}
<label class='nav prev' for="v{{ $prev }}"></label>
<label class='nav next' for="v{{ $next }}"></label>
<h2>{{ .Title }}</h2>
<div class='summary'>
{{ truncate 230 "..." .Summary }}
</div>
</a>
</li>
{{ end }}
{{ end }}
</ul>
</div>
<h1 class='with-divider'><span>Em destaque</span></h1>
{{ $articles := (where .Site.RegularPages "Params.destaque" true) }}
<ul class='articles'>
{{ range $articles }}
<li>
{{ $cover := (index (.Resources.ByType "image") 0) }}
{{ if $cover }}
<img src="{{ $cover.Permalink }}" alt="{{ .Params.coverdescription }}" title="{{ .Params.coverdescription }}" />
{{ end }}
<h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
<div class='summary'>
{{ .Summary }}
</div>
<p class='readmore'><a href="{{ .Permalink }}">Ler artigo completo →</a></p>
{{ partial "byline.html" . }}
</li>
{{ end }}
</ul>
<h2 class='with-divider'><span>Mais artigos</span></h2>
{{ $articles := (where .Site.RegularPages "Section" "artigos") }}
{{ $recent := (first 5 (sort $articles "Date" "desc")) }}
<ul class='articles'>
{{ range $recent }}
<li>
{{ $cover := (index (.Resources.ByType "image") 0) }}
{{ if $cover }}
<img src="{{ $cover.Permalink }}" alt="{{ .Params.coverdescription }}" title="{{ .Params.coverdescription }}" />
{{ end }}
<h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
<div class='summary'>
{{ .Summary }}
</div>
<p class='readmore'><a href="{{ .Permalink }}">Ler artigo completo →</a></p>
{{ partial "byline.html" . }}
</li>
{{ end }}
</ul>
{{ end }}