pollux.codes

Files for the pollux.codes site
git clone git://pollux.codes/git/pollux.codes.git
Log | Files | Refs

commit 4513e701eaedd76b695a753d0e250909818e4b86
parent e0c0af4c0b5fb948dcd83044ecf5a1ea5a584d1d
Author: Pollux <pollux@pollux.codes>
Date:   Wed, 22 Jan 2025 21:42:42 -0600

Add tags to blog and art

Signed-off-by: Pollux <pollux@pollux.codes>

Diffstat:
Mcontent/art/_index.md | 2--
Mcontent/art/calligraphy.md | 1+
Mcontent/art/fractured-ridge.md | 1+
Mcontent/blog/_index.md | 2--
Mcontent/blog/testing.md | 1+
Mhugo.toml | 8++++++++
Mlayouts/art/list.html | 9+++++++--
Mlayouts/art/single.html | 2+-
Alayouts/blog/list.html | 15+++++++++++++++
Mlayouts/blog/single.html | 1+
10 files changed, 35 insertions(+), 7 deletions(-)

diff --git a/content/art/_index.md b/content/art/_index.md @@ -13,5 +13,3 @@ of the page for more info). The preview is low resolution to save bandwidth. Click on each image for the full-res version. - -## Pieces diff --git a/content/art/calligraphy.md b/content/art/calligraphy.md @@ -1,6 +1,7 @@ +++ title = 'Calligraphy' date = 2025-01-18T21:51:51-06:00 +arttags = ['fractal', 'catppuccin'] [params] file = "calligraphy.png" +++ diff --git a/content/art/fractured-ridge.md b/content/art/fractured-ridge.md @@ -1,6 +1,7 @@ +++ title = 'Fractured Ridge' date = 2025-01-18T21:17:26-06:00 +arttags = ['fractal', 'catppuccin'] [params] file = "fractured-ridge.png" +++ diff --git a/content/blog/_index.md b/content/blog/_index.md @@ -6,5 +6,3 @@ date = 2025-01-18T16:33:56-06:00 # Blog A blog for me to talk about things that interest me. - -## Posts diff --git a/content/blog/testing.md b/content/blog/testing.md @@ -1,6 +1,7 @@ +++ title = 'Testing!' date = 2025-01-18T17:30:24-06:00 +blogtags = ['meta'] +++ *Taps mic...* diff --git a/hugo.toml b/hugo.toml @@ -2,6 +2,14 @@ baseURL = 'https://pollux.codes/' languageCode = 'en-us' title = 'pollux codes' +[taxonomies] + blogtags = 'blogtags' + arttags = 'arttags' + +[permalinks] + blogtags = "/blog/tags/:title" + arttags = "/art/tags/:title" + [params] [params.author] name = 'Pollux' diff --git a/layouts/art/list.html b/layouts/art/list.html @@ -1,13 +1,18 @@ {{ define "main" }} {{ .Content }} +<hr> +{{ with .Site.Taxonomies.arttags.ByCount }} +{{ range $k, $term := . }}{{ if $k }}, {{ end }}<a href="{{ "/art/tags/" | relLangURL}}{{ .Name | urlize }}">{{ .Name }} ({{ len .WeightedPages }})</a>{{ end }} +{{ end }} +<hr> {{ range .Pages }} -<h3>{{ .Date.Format "2006-01-02" }} {{ .Title }}</h3> +<h2>{{ .Date.Format "2006-01-02" }} {{ .Title }}</h2> {{ $file := printf "artwork/%s" .Params.file }} {{ $image := resources.GetMatch $file }} {{ $imageSmall := $image.Resize "512x" }} {{ $imageBlur := $imageSmall.Filter (images.GaussianBlur 32) }} {{ $sizemb := (div (div (len $image.Content) 104858) 10.0) }} -<p><i>{{ $image.Width }}x{{ $image.Height }}, {{ $sizemb }}MiB</i></p> +<p><i>{{ $image.Width }}x{{ $image.Height }}, {{ $sizemb }}MiB</i>{{ range .GetTerms "arttags" }}, <a href="{{ .RelPermalink }}">{{ lower .Title }}</a>{{ end }}</p> {{ .Content }} <a href="{{ .RelPermalink }}"><img src="{{if .Params.censor }}{{ $imageBlur.RelPermalink }}{{ else }}{{ $imageSmall.RelPermalink }}{{ end }}" width="100%"></a> {{ end }} diff --git a/layouts/art/single.html b/layouts/art/single.html @@ -3,7 +3,7 @@ {{ $image := resources.GetMatch $file }} {{ $sizemb := (div (div (len $image.Content) 104858) 10.0) }} <h1>{{ .Title }}</h1> -<p><i>{{ $image.Width }}x{{ $image.Height }}, {{ $sizemb }}MiB</i></p> +<p><i>{{ $image.Width }}x{{ $image.Height }}, {{ $sizemb }}MiB</i>{{ range .GetTerms "arttags" }}, <a href="{{ .RelPermalink }}">{{ lower .Title }}</a>{{ end }}</p> {{ .Content }} <a href="{{ $image.RelPermalink }}"><img src="{{ $image.RelPermalink }}" width="100%"></a> {{ end }} diff --git a/layouts/blog/list.html b/layouts/blog/list.html @@ -0,0 +1,15 @@ +{{ define "main" }} +{{ .Content }} +<hr> +{{ with .Site.Taxonomies.blogtags.ByCount }} +{{ range $k, $term := . }}{{ if $k }}, {{ end }}<a href="{{ "/blog/tags/" | relLangURL}}{{ .Name | urlize }}">{{ .Name }} ({{ len .WeightedPages }})</a>{{ end }} +{{ end }} +<hr> +<ul> +{{ range .Pages }} +<li> + {{ .Date.Format "2006-01-02" }} <a href="{{ .RelPermalink }}">{{ .Title }}</a> +</li> +{{ end }} +</ul> +{{ end }} diff --git a/layouts/blog/single.html b/layouts/blog/single.html @@ -1,5 +1,6 @@ {{ define "main" }} <h1>{{ .Title }}</h1> <p>Written on {{ .Date.Format "2006-01-02" }}.</p> +{{ range $k, $term := .GetTerms "blogtags" }}{{ if $k }}, {{ end }}<a href="{{ .RelPermalink }}">{{ lower .Title }}</a>{{ end }} {{ .Content }} {{ end }}