hugo_frigg/layouts/archives/single.html

68 lines
2.3 KiB
HTML
Raw Normal View History

2021-10-26 11:34:30 +02:00
{{ partial "header.html" . }}
<body>
<main class="wrapper">
{{ partial "navigation.html" . }}
<section class="container archive">
<article>
<header class="post-header">
<h1 class="post-title">
{{ .Title }}
</h1>
{{ $img := newScratch }}
{{ $folder := (print "/content/" .File.Dir "gallery/") }}
{{ $files := readDir $folder }}
{{ $img.Set "max" 0 }}
2021-10-26 11:34:30 +02:00
{{ range sort $files "Name" "asc" }}
{{ if not .IsDir }}
{{ if not (in .Name "thumb") }}
{{ $img.Add "list" (slice .Name) }}
{{ $img.Set "max" (add ($img.Get "max") 1) }}
{{ end }}
2021-10-26 11:34:30 +02:00
{{ end }}
{{ end }}
{{ range $index, $val := $img.Get "list" }}
{{ $curr := index (split $val ".") 0 }}
{{ $prec := mod (add (sub $index 1) ($img.Get "max")) ($img.Get "max") }}
{{ $next := mod (add $index 1) ($img.Get "max") }}
<a class="thumb hidden_link" href="#img{{ $index }}">
<picture>
<source srcset="gallery/{{ $curr }}.thumb.avif" type="image/avif"/>
<source srcset="gallery/{{ $curr }}.thumb.webp" type="image/webp"/>
<img src="gallery/{{ $curr }}.thumb.jpg"/>
</picture>
2021-10-26 11:34:30 +02:00
</a>
<!-- lightbox container hidden with CSS -->
<div class="lightbox" id="img{{ $index }}">
2021-10-26 11:34:30 +02:00
<a href="#img{{ $prec }}" class="light-btn hidden_link btn-prev"><<</a>
<a href="#_" class="btn-close hidden_link">X</a>
<img src="gallery/{{ $val }}">
<a href="#img{{ $next }}" class="light-btn hidden_link btn-next">>></a>
</div>
{{ end }}
<div class="post-meta">
<!--div class="date">
<span class="posted-on">
<img class="page-icon header-icon" src="/svg/calendar.svg"/>
<time datetime='{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}'>
Article publié le {{ .Date.Day }} {{ index $.Site.Data.snotra.mois (printf "%d" .Date.Month) }} {{ .Date.Year }}
</time>
</span>
<span class="reading-time">
<img class="page-icon header-icon" src="/svg/clock.svg"/>
{{ i18n "reading_time" .ReadingTime }}
</span>
</div-->
{{ partial "categories.html" .Page.Params.Categories }}
{{ partial "tags.html" .Page.Params.Tags }}
</div>
</header>
<div class="archive-body">
{{ .Content }}
</div>
{{ partial "article-footer.html" . }}
</article>
</section>
</main>
</body>
</html>