Files
bridget/layouts/index.html
Spedon a36abb412a add overlay section
add use json to store images data
2023-03-11 14:37:15 +08:00

40 lines
1.2 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
{{- partial "head.html" . -}}
<title>{{ .Title }}</title>
</head>
<body>
<header>
{{- partial "header.html" . -}}
</header>
<div class="overlay">
<section class="prev_section"></section>
<section class="close_section"></section>
<section class="next_section"></section>
<div class="overlay_cursor"></div>
</div>
<div id="main">
{{ $sourcePath := "images" }}
{{ $gallery := site.GetPage $sourcePath }}
{{ with $gallery.Resources.ByType "image" }}
{{ $index := len . }}
{{ $.Scratch.Add "img" slice }}
{{ range . }}
{{ $index = sub $index 1}}
{{ $.Scratch.Add "img" (dict "link" .RelPermalink "height" .Height "width" .Width) }}
<div class="image_container" data-index="{{ $index }}" data-status="inactive">
<img src="{{ .RelPermalink }}" height="{{ .Height }}" width="{{ .Width }}"/>
</div>
{{ end }}
<script id="images_array" type="application/json">{{ $.Scratch.Get "img" | jsonify | safeJS }}</script>
{{ end }}
</div>
<footer>
{{ partial "footer.html" . }}
</footer>
</body>
</html>