summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Elliott Hand <jhand@hawaii.edu>2026-07-23 13:29:47 -1000
committerJoseph Elliott Hand <jhand@hawaii.edu>2026-07-23 13:29:47 -1000
commit722bb79adfe7b646949b35b4d2306c93f9b7d7b6 (patch)
tree2b5319b919a6dad8977808f59ce4ea59d046f42d
parent4bd6e1ee6aac058eaae081ce9a7b31295a19eab1 (diff)
downloadjosephhand.space-722bb79adfe7b646949b35b4d2306c93f9b7d7b6.tar.gz
Add tags to blogHEADmaster
Signed-off-by: Joseph Elliott Hand <jhand@hawaii.edu>
-rw-r--r--content/blog/intro-to-compiling-c/index.md1
-rw-r--r--hugo.toml10
-rw-r--r--layouts/blog/page.html9
-rw-r--r--layouts/blog/section.html3
-rw-r--r--layouts/blog_tags/term.html10
5 files changed, 31 insertions, 2 deletions
diff --git a/content/blog/intro-to-compiling-c/index.md b/content/blog/intro-to-compiling-c/index.md
index 56f06b5..293382e 100644
--- a/content/blog/intro-to-compiling-c/index.md
+++ b/content/blog/intro-to-compiling-c/index.md
@@ -1,6 +1,7 @@
+++
date = '2026-07-19T19:46:49-10:00'
title = 'Intro to Compiling C'
+blog_tags = ['C', 'code']
+++
This guide explains to someone very new to C how to make compiling C code as
diff --git a/hugo.toml b/hugo.toml
index e821679..5813d34 100644
--- a/hugo.toml
+++ b/hugo.toml
@@ -3,8 +3,14 @@ languageCode = 'en-us'
title = 'Joseph Hand'
[markup]
- [markup.highlight]
- style = "pygments"
+ [markup.highlight]
+ style = "pygments"
+
+[taxonomies]
+ blog_tag = "blog_tags"
+
+[permalinks]
+ blog_tags = "/blog/tags/:slug"
[menus]
[[menus.nav]]
diff --git a/layouts/blog/page.html b/layouts/blog/page.html
index 67e7901..bd051cc 100644
--- a/layouts/blog/page.html
+++ b/layouts/blog/page.html
@@ -1,5 +1,14 @@
{{ define "main" }}
<h1>{{ .Title }}</h1>
<p>{{ .Date.Format "Jan 2, 2006" }} &ndash; {{ .WordCount }} words, ~{{ .ReadingTime }} minutes</p>
+{{- if isset .Params "blog_tags" -}}
+{{- $tagsLen := len .Params.blog_tags -}}
+{{- if gt $tagsLen 0 -}}
+<p>
+{{- range $i, $v := .Params.blog_tags -}}
+{{- if $i }},{{ end }} <a href="/blog/tags/{{ . | urlize }}/">{{ $v }}</a>
+{{- end -}}</p>
+{{- end -}}
+{{- end -}}
{{ .Content }}
{{ end }}
diff --git a/layouts/blog/section.html b/layouts/blog/section.html
index 4bbfd38..d153a19 100644
--- a/layouts/blog/section.html
+++ b/layouts/blog/section.html
@@ -1,5 +1,8 @@
{{ define "main" }}
<h1>{{ .Title }}</h1>
+<p>Explore tags:
+{{- $tagsLen := len .Site.Taxonomies.blog_tags }}
+{{ range $i, $term := .Site.Taxonomies.blog_tags.ByCount }}{{ if $i }},{{ end }} <a href="{{ .Page.Permalink }}">{{ $term.Name }}</a> ({{ $term.Count }}){{ end }}</p>
{{ .Content }}
<ul>
{{ range.Pages -}}
diff --git a/layouts/blog_tags/term.html b/layouts/blog_tags/term.html
new file mode 100644
index 0000000..04cf050
--- /dev/null
+++ b/layouts/blog_tags/term.html
@@ -0,0 +1,10 @@
+{{ define "main" }}
+<h1>Posts Tagged With "{{ .Title }}"</h1>
+<ul>
+{{ range .Pages }}
+ <li>
+ {{ .Date.Format "2006, Jan 2" }} &ndash; <a href="{{ .Permalink }}">{{ .Title }}</a>
+ </li>
+{{ end }}
+</ul>
+{{ end }}