From d343f0b8575a02a872f4cfbde314da4d0b60b53c Mon Sep 17 00:00:00 2001
From: Patrick Kollitsch <davidsneighbourdev+gh@gmail.com>
Date: Sun, 07 Jun 2026 03:36:45 +0000
Subject: [PATCH] feat: make section link above article title clickable and configurable

---
 layouts/_partials/hooks/article/section-link.html |   33 ++++++++++++++++++++++++++++++---
 1 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/layouts/_partials/hooks/article/section-link.html b/layouts/_partials/hooks/article/section-link.html
index 827bf0d..421cf8e 100644
--- a/layouts/_partials/hooks/article/section-link.html
+++ b/layouts/_partials/hooks/article/section-link.html
@@ -1,3 +1,30 @@
-<aside class="instapaper_ignoref b helvetica tracked ttu">
-    {{ .CurrentSection.Title }}
-</aside>
\ No newline at end of file
+{{- /*
+  Renders the section label above the article title, linked to a page within
+  the section. The link target is controlled by the `ananke.section_link`
+  parameter (page front matter, or site params for a site-wide default):
+
+    - unset (default): the section index page (its `_index.md`)
+    - "first":         the first page of the section, honouring its sort order
+    - "<path>":        a specific page, resolved relative to the section
+                       (e.g. "introduction" or "/about")
+
+  The visible label is always the section title; only the destination changes.
+*/ -}}
+{{- with .CurrentSection -}}
+  {{- $section := . -}}
+  {{- $target := $section -}}
+  {{- with $.Param "ananke.section_link" -}}
+    {{- if eq . "first" -}}
+      {{- with first 1 $section.RegularPages -}}
+        {{- $target = index . 0 -}}
+      {{- end -}}
+    {{- else -}}
+      {{- with $section.GetPage . -}}
+        {{- $target = . -}}
+      {{- end -}}
+    {{- end -}}
+  {{- end -}}
+  <aside class="instapaper_ignoref b helvetica tracked ttu">
+    <a class="link dim" href="{{ $target.Permalink }}">{{ $section.Title }}</a>
+  </aside>
+{{- end -}}

--
Gitblit v1.10.0