Add music page

This commit is contained in:
Joshua Goins 2022-08-24 10:24:04 -04:00
parent 6ef98c48a4
commit 5c54e08e34
4 changed files with 63 additions and 0 deletions

BIN
assets/music/test.opus Normal file

Binary file not shown.

9
content/music/_index.md Normal file
View file

@ -0,0 +1,9 @@
---
title: "Music"
layout: "audio-gallery"
json: "music"
---
This is a collection of music I have created.
{{< toc >}}

20
data/music.json Normal file
View file

@ -0,0 +1,20 @@
{
"categories": [
{
"name": "Music",
"description": "This is my extremely small music collection.",
"years": [
{
"year": 2022,
"pieces": [
{
"title": "you call this a town theme?",
"filename": "test.opus",
"newgrounds_url": "google.com"
}
]
}
]
}
]
}

View file

@ -0,0 +1,34 @@
{{ define "main" }}
<h2>{{ .Title }}</h2>
{{ .Content }}
{{ $art := (index site.Data ($.Param "json")) }}
{{ range $art.categories }}
<h2>{{ .name }}</h2>
<p>{{ .description }}</p>
{{ range sort .years "year" "desc" }}
<h3>{{ .year }}</h3>
<div class="gallery">
{{ range .pieces }}
<figure>
{{ $full := resources.Get (printf "%s/%s" ($.Param "json") .filename) }}
<audio controls>
<source src="{{ $full.Permalink }}" type="audio/ogg">
</audio>
<figcaption>
"{{ .title }}"
{{ if .newgrounds_url }}
<a href="{{ .newgrounds_url }}">Newgrounds</a>
{{ end }}
</figcaption>
</figure>
{{ end }}
</div>
{{ end }}
{{ end }}
{{ end }}