Add photos section, allow disabling thumbs for galleries

This commit is contained in:
Joshua Goins 2022-08-04 09:22:51 -04:00
parent 443f279034
commit 9e38bb0f73
6 changed files with 41 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 KiB

View file

@ -1,3 +1,5 @@
See my [gallery](/art)! See my [gallery](/art)!
See my [photos](/photos)!
See my [about page](/about)! See my [about page](/about)!

View file

@ -1,6 +1,8 @@
--- ---
title: "Art" title: "Art"
layout: "gallery" layout: "gallery"
json: "art"
thumbnails: true
--- ---
Welcome to my gallery! I try to include some of my old art here as well, which I've kept since ~2016. Welcome to my gallery! I try to include some of my old art here as well, which I've kept since ~2016.

8
content/photos/_index.md Normal file
View file

@ -0,0 +1,8 @@
---
title: "Art"
layout: "gallery"
json: "photos"
thumbnails: false
---
{{< toc >}}

19
data/photos.json Normal file
View file

@ -0,0 +1,19 @@
{
"categories": [
{
"name": "Figures",
"description": "This is a photo collection of my figure collection.",
"years": [
{
"year": 2022,
"pieces": [
{
"title": "2B",
"filename": "20220519_0001.webp"
}
]
}
]
}
]
}

View file

@ -1,19 +1,25 @@
{{ define "main" }} {{ define "main" }}
{{ .Content }} {{ .Content }}
{{ $art := site.Data.art }} {{ $art := (index site.Data ($.Param "json")) }}
{{ range $art.categories }} {{ range $art.categories }}
<h2>{{ .name }}</h2> <h2>{{ .name }}</h2>
<p>{{ .description }}</p>
{{ range sort .years "year" "desc" }} {{ range sort .years "year" "desc" }}
<h3>{{ .year }}</h3> <h3>{{ .year }}</h3>
{{ range .pieces }} {{ range .pieces }}
<figure> <figure>
{{ $thumb := resources.Get (printf "art-thumbs/%s" .filename) }} {{ $full := resources.Get (printf "%s/%s" ($.Param "json") .filename) }}
{{ $full := resources.Get (printf "art/%s" .filename) }}
<a href="{{ $full.Permalink }}"> <a href="{{ $full.Permalink }}">
<img width="128px" height="128px" src="{{ $thumb.Permalink }}"/> {{ if $.Params.thumbnails }}
{{ $thumb := resources.Get (printf "%s-thumbs/%s" ($.Param "json") .filename) }}
<img width="128px" height="128px" src="{{ $thumb.Permalink }}"/>
{{ else }}
<img src="{{ $full.Permalink }}"/>
{{ end }}
</a> </a>
<figcaption>"{{ .title }}"</figcaption> <figcaption>"{{ .title }}"</figcaption>