overhaul gallery to new style
This commit is contained in:
parent
c30ecce826
commit
7cf9fbadad
3 changed files with 40 additions and 75 deletions
|
@ -34,60 +34,24 @@
|
||||||
{{ if eq (int .year) (int $selected_year) }}
|
{{ if eq (int .year) (int $selected_year) }}
|
||||||
{{ $year := .year }}
|
{{ $year := .year }}
|
||||||
|
|
||||||
<div class="gallery-con">
|
<div class="grid">
|
||||||
{{ range .pieces }}
|
{{ range .pieces }}
|
||||||
<figure class="gallery-fig">
|
|
||||||
{{ $full := resources.Get (printf "%s/%s" ($.Param "json") .filename) }}
|
|
||||||
{{ if $full }}
|
|
||||||
|
|
||||||
{{ $filename_without_ext := strings.TrimSuffix (path.Ext .filename) .filename }}
|
{{ $filename_without_ext := strings.TrimSuffix (path.Ext .filename) .filename }}
|
||||||
|
|
||||||
{{ $month := 1 }}
|
{{ $path := printf "/art/%s" $filename_without_ext}}
|
||||||
|
{{ with $.Site.GetPage $path }}
|
||||||
{{ if .date }}
|
{{ partial "render-art" . }}
|
||||||
{{ $split := split .date "-" }}
|
|
||||||
{{ $month = index $split 0 }}
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ $path := printf "/art/%d/%.2d/%s" (int $year) (int $month) $filename_without_ext}}
|
|
||||||
|
|
||||||
<a href="{{ $path }}" aria-label="Click to view details">
|
|
||||||
{{ if $.Params.thumbnails }}
|
|
||||||
{{ $title := .title }}
|
|
||||||
{{ with resources.Get (printf "%s-thumbs/%s" ($.Param "json") .filename) }}
|
|
||||||
<img class="gallery-img" alt="{{ $title }}" width="128" height="128" src="{{ .Permalink }}"/>
|
|
||||||
{{ else }}
|
|
||||||
<p>Thumbnail not found!</p>
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ else }}
|
|
||||||
<img alt="{{ .title }}" src="{{ $full.Permalink }}"/>
|
|
||||||
{{ end }}
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<figcaption>
|
|
||||||
|
|
||||||
{{ with .title }}
|
|
||||||
"{{ . }}"
|
|
||||||
{{ end }}
|
|
||||||
{{ if .newgrounds_url }}
|
|
||||||
<a href="{{ .newgrounds_url }}" style="vertical-align: bottom"><img alt="Newgrounds Icon" style="vertical-align: bottom" width="19" height="19" src="{{ $newgrounds_icon.Permalink }}"></a>
|
|
||||||
{{ end }}
|
|
||||||
{{ if .pixiv_url }}
|
|
||||||
<a href="{{ .pixiv_url }}" style="vertical-align: bottom"><img alt="Pixiv Icon" style="vertical-align: bottom" width="19" height="19" src="{{ $pixiv_icon.Permalink }}"></a>
|
|
||||||
{{ end }}
|
|
||||||
</figcaption>
|
|
||||||
|
|
||||||
{{ else }}
|
|
||||||
|
|
||||||
<em>CANNOT FIND {{.filename }}</em>
|
|
||||||
|
|
||||||
{{ end }}
|
|
||||||
</figure>
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{ $site := resources.Get "js/site.js" }}
|
||||||
|
{{ if hugo.IsProduction }}
|
||||||
|
{{ $site = $site | minify | fingerprint | resources.PostProcess }}
|
||||||
|
{{ end }}
|
||||||
|
<script src="{{ $site.RelPermalink }}" integrity="{{ $site.Data.Integrity }}"></script>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
@ -2,35 +2,7 @@
|
||||||
|
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
{{ range $paginator.Pages }}
|
{{ range $paginator.Pages }}
|
||||||
{{ $full := resources.Get (printf "art/%s.webp" .Params.slug) }}
|
{{ partial "render-art" . }}
|
||||||
{{ if $full }}
|
|
||||||
|
|
||||||
{{ $filename_without_ext := .Params.slug }}
|
|
||||||
|
|
||||||
{{ $month := 1 }}
|
|
||||||
{{ $year := 1 }}
|
|
||||||
|
|
||||||
{{ if .Params.date }}
|
|
||||||
{{ $split := split .Params.date "-" }}
|
|
||||||
{{ $month = index $split 0 }}
|
|
||||||
{{ $year = index $split 3 }}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
<a href="{{ .Permalink }}">
|
|
||||||
{{ $path := printf "/art/%d/%.2d/%s" (int $year) (int $month) $filename_without_ext}}
|
|
||||||
{{ $title := .Params.title }}
|
|
||||||
{{ $image := (resources.Get (printf "art/%s.webp" .Params.slug)).Resize "300x" }}
|
|
||||||
{{ with $image }}
|
|
||||||
<img class="grid-item" width="{{ .Width }}" height="{{ .Height }}" alt="{{ $title }}" src="{{ .Permalink }}"/>
|
|
||||||
{{ else }}
|
|
||||||
<p>Thumbnail not found!</p>
|
|
||||||
{{ end }}
|
|
||||||
{{ else }}
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<em>CANNOT FIND {{.Params.slug }}</em>
|
|
||||||
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
29
themes/red/layouts/partials/render-art.html
Normal file
29
themes/red/layouts/partials/render-art.html
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
{{ $full := resources.Get (printf "art/%s.webp" .Params.slug) }}
|
||||||
|
{{ if $full }}
|
||||||
|
|
||||||
|
{{ $filename_without_ext := .Params.slug }}
|
||||||
|
|
||||||
|
{{ $month := 1 }}
|
||||||
|
{{ $year := 1 }}
|
||||||
|
|
||||||
|
{{ if .Params.date }}
|
||||||
|
{{ $split := split .Params.date "-" }}
|
||||||
|
{{ $month = index $split 0 }}
|
||||||
|
{{ $year = index $split 3 }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
<a href="{{ .Permalink }}">
|
||||||
|
{{ $path := printf "/art/%d/%.2d/%s" (int $year) (int $month) $filename_without_ext}}
|
||||||
|
{{ $title := .Params.title }}
|
||||||
|
{{ $image := (resources.Get (printf "art/%s.webp" .Params.slug)).Resize "300x" }}
|
||||||
|
{{ with $image }}
|
||||||
|
<img class="grid-item" width="{{ .Width }}" height="{{ .Height }}" alt="{{ $title }}" src="{{ .Permalink }}"/>
|
||||||
|
{{ else }}
|
||||||
|
<p>Thumbnail not found!</p>
|
||||||
|
{{ end }}
|
||||||
|
</a>
|
||||||
|
{{ else }}
|
||||||
|
|
||||||
|
<em>CANNOT FIND {{.Params.slug }}</em>
|
||||||
|
|
||||||
|
{{ end }}
|
Loading…
Add table
Reference in a new issue