Add JSON gallery support

This commit is contained in:
Joshua Goins 2022-08-02 14:05:56 -04:00
parent 8a8e587d4e
commit 42343c9563
17 changed files with 101 additions and 11 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 KiB

BIN
assets/art/office-date.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 362 KiB

View file

@ -1,3 +1,4 @@
baseURL = 'http://example.org/'
languageCode = 'en-us'
title = 'My New Hugo Site'
theme = 'red'

1
content/about.md Normal file
View file

@ -0,0 +1 @@

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

@ -0,0 +1,8 @@
---
title: "Art"
layout: "gallery"
---
Welcome to my gallery! I try to include some of my old art here as well, which I've kept since ~2016.
{{< toc >}}

44
data/art/art.json Normal file
View file

@ -0,0 +1,44 @@
{
"categories": [
{
"name": "2D Art",
"description": "This is a collection of my “finished” work, sorted by year originally posted.",
"years": [
{
"year": 2016,
"pieces": [
{
"title": "Old Stuff",
"filename": "summer-byleth.webp"
},
{
"title": "Another old thing",
"filename": "summer-byleth.webp"
}
]
},
{
"year": 2022,
"pieces": [
{
"title": "summer byleth",
"filename": "summer-byleth.webp"
},
{
"title": "summer eva girls",
"filename": "summer-eva-girls.webp"
},
{
"title": "office date",
"filename": "office-date.webp"
},
{
"title": "after school",
"filename": "after-school.webp"
}
]
}
]
}
]
}

View file

@ -0,0 +1,24 @@
{{ define "main" }}
{{ .Content }}
{{ $art := site.Data.art.art }}
{{ range $art.categories }}
<h2>{{ .name }}</h2>
{{ range sort .years "year" "desc" }}
<h3>{{ .year }}</h3>
{{ range .pieces }}
<figure>
{{ $local := resources.Get (printf "art-thumbs/%s" .filename) }}
{{ $full :=resources.Get (printf "art/%s" .filename) }}
<a href="{{ $full.Permalink }}">
<img width="128px" height="128px" src="{{ $local.Permalink }}"/>
</a>
<figcaption>"{{ .title }}"</figcaption>
</figure>
{{ end }}
{{ end }}
{{ end }}
{{ end }}

View file

@ -0,0 +1,7 @@
{{ define "main" }}
<h2>{{ .Title }}</h2>
{{ .Content }}
{{ end }}

View file

@ -0,0 +1,7 @@
{{ define "main" }}
<h2>{{ .Title }}</h2>
{{ .Content }}
{{ end }}

View file

@ -0,0 +1,4 @@
<details>
<summary>Table of Contents</summary>
{{ .Page.TableOfContents }}
</details>

View file

@ -1,21 +1,15 @@
# theme.toml template for a Hugo theme
# See https://github.com/gohugoio/hugoThemes#themetoml for an example
name = "Red"
name = "red"
license = "MIT"
licenselink = "https://github.com/yourname/yourtheme/blob/master/LICENSE"
licenselink = "https://git.sr.ht/~redstrate/redstrate.com/tree/master/item/themes/red/LICENSE"
description = ""
homepage = "http://example.com/"
homepage = "https://redstrate.com/"
tags = []
features = []
min_version = "0.41.0"
[author]
name = ""
homepage = ""
# If porting an existing theme
[original]
name = ""
homepage = ""
repo = ""
name = "redstrate <josh@redstrate.com>"
homepage = "https://redstrate.com/"