git-preview @ main

static git web frontend but with images and html previews + code truncation

templates/showcase.html

 1{{ define "showcase" }}
 2{{ if .showcase }}
 3{{ $repo := .name }}
 4{{ $ref := .showcaseref }}
 5<section class="showcase">
 6  {{ range .showcase }}
 7  <figure class="showcase-item">
 8    {{ if eq .Kind "image" }}
 9    <img src="/{{ $repo }}/showcase/{{ $ref }}/{{ .Asset }}" alt="{{ .Caption }}" loading="lazy">
10    {{ else if eq .Kind "video" }}
11    <video controls preload="metadata" src="/{{ $repo }}/showcase/{{ $ref }}/{{ .Asset }}"></video>
12    {{ else if eq .Kind "html" }}
13    <iframe sandbox="allow-scripts" src="/{{ $repo }}/showcase/{{ $ref }}/{{ .Asset }}"
14            style="height: {{ .IframeHeight }}px" title="{{ .Caption }}"></iframe>
15    {{ end }}
16    {{ if .Caption }}<figcaption>{{ .Caption }}</figcaption>{{ end }}
17  </figure>
18  {{ end }}
19</section>
20{{ end }}
21{{ end }}