]> danix's work - danix.xyz-2.git/commitdiff
Implement taxonomy system for tags and categories
authorDanilo M. <redacted>
Wed, 15 Apr 2026 20:05:38 +0000 (22:05 +0200)
committerDanilo M. <redacted>
Wed, 15 Apr 2026 20:05:38 +0000 (22:05 +0200)
- Enable tags and categories taxonomies in hugo.toml
- Create taxonomy/list.html for archive pages (/tags, /categories)
- Create taxonomy/term.html for individual term pages (/tags/example)
- Add quote shortcode for quote-type articles
- Both templates reuse article-list-item partial for consistent styling

Co-Authored-By: Claude Haiku 4.5 <redacted>
hugo.toml
themes/danix-xyz-hacker/layouts/shortcodes/quote.html [new file with mode: 0644]
themes/danix-xyz-hacker/layouts/taxonomy/list.html [new file with mode: 0644]
themes/danix-xyz-hacker/layouts/taxonomy/term.html [new file with mode: 0644]

index a3970cea72eabc77f9c751c53bad5d259fb8ca91..f5019c0268d7d7387f3a8a18ce0431d24699754f 100644 (file)
--- a/hugo.toml
+++ b/hugo.toml
@@ -77,6 +77,11 @@ enableRobotsTXT = true
       name = "legal"
       weight = 4
 
+# Taxonomies
+[taxonomies]
+  tag = "tags"
+  category = "categories"
+
 # Theme parameters
 [params]
   siteName = "danix.xyz"
diff --git a/themes/danix-xyz-hacker/layouts/shortcodes/quote.html b/themes/danix-xyz-hacker/layouts/shortcodes/quote.html
new file mode 100644 (file)
index 0000000..1ed5c3c
--- /dev/null
@@ -0,0 +1,15 @@
+{{- $source := .Get "source" -}}
+{{- $src := .Get "src" -}}
+
+<blockquote class="my-8 pl-6 border-l-4 border-accent/50 italic text-text-dim">
+  <p class="text-lg">{{ .Inner }}</p>
+  {{- if $source -}}
+    <footer class="mt-4 text-sm not-italic text-text-dim">
+      {{- if $src -}}
+        — <a href="{{ $src }}" class="text-accent hover:underline">{{ $source }}</a>
+      {{- else -}}
+        — {{ $source }}
+      {{- end -}}
+    </footer>
+  {{- end -}}
+</blockquote>
diff --git a/themes/danix-xyz-hacker/layouts/taxonomy/list.html b/themes/danix-xyz-hacker/layouts/taxonomy/list.html
new file mode 100644 (file)
index 0000000..fd4b5d9
--- /dev/null
@@ -0,0 +1,31 @@
+{{ define "main" }}
+<div class="mx-auto px-4 py-12 max-w-4xl">
+  <!-- Page title with taxonomy name -->
+  <h1 class="text-4xl md:text-5xl font-bold text-accent mb-12">
+    {{ i18n .Data.Plural }}
+  </h1>
+
+  <!-- Articles list -->
+  <div class="space-y-2 max-w-2xl">
+    {{ $pinned := where .Pages "Params.pinned" true }}
+    {{ $unpinned := where .Pages "Params.pinned" false }}
+
+    <!-- Pinned posts first -->
+    {{ range (sort $pinned "Date" "desc") }}
+      {{ partial "article-list-item.html" . }}
+    {{ end }}
+
+    <!-- Regular posts -->
+    {{ range (sort $unpinned "Date" "desc") }}
+      {{ partial "article-list-item.html" . }}
+    {{ end }}
+
+    <!-- Empty state -->
+    {{ if eq (len .Pages) 0 }}
+      <div class="py-12 text-center text-text-dim">
+        {{ i18n "noRelated" }}
+      </div>
+    {{ end }}
+  </div>
+</div>
+{{ end }}
diff --git a/themes/danix-xyz-hacker/layouts/taxonomy/term.html b/themes/danix-xyz-hacker/layouts/taxonomy/term.html
new file mode 100644 (file)
index 0000000..5353715
--- /dev/null
@@ -0,0 +1,38 @@
+{{ define "main" }}
+<div class="mx-auto px-4 py-12 max-w-4xl">
+  <!-- Page title with taxonomy type -->
+  <h1 class="text-4xl md:text-5xl font-bold text-accent mb-2">
+    {{ i18n .Data.Singular }}
+  </h1>
+
+  <!-- Current term heading -->
+  <p class="text-lg text-text-dim mb-12">
+    <span class="inline-flex items-center px-3 py-1 rounded text-sm font-medium border border-accent/30 text-accent">
+      {{ .Title }}
+    </span>
+  </p>
+
+  <!-- Articles list -->
+  <div class="space-y-2 max-w-2xl">
+    {{ $pinned := where .Pages "Params.pinned" true }}
+    {{ $unpinned := where .Pages "Params.pinned" false }}
+
+    <!-- Pinned posts first -->
+    {{ range (sort $pinned "Date" "desc") }}
+      {{ partial "article-list-item.html" . }}
+    {{ end }}
+
+    <!-- Regular posts -->
+    {{ range (sort $unpinned "Date" "desc") }}
+      {{ partial "article-list-item.html" . }}
+    {{ end }}
+
+    <!-- Empty state -->
+    {{ if eq (len .Pages) 0 }}
+      <div class="py-12 text-center text-text-dim">
+        {{ i18n "noRelated" }}
+      </div>
+    {{ end }}
+  </div>
+</div>
+{{ end }}