Tables with a header row can be sorted by clicking a column header

Listing tables on company, taxonomy and generic list pages get column headers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YDRjtmAiNpo5mK5N3d7QwZ
This commit is contained in:
2026-10-12 21:03:41 +02:00
co-authored by Claude Opus 5.5
parent c913d792c4
commit dfb2d2ce68
7 changed files with 83 additions and 12 deletions
+12 -4
View File
@@ -1,14 +1,22 @@
{{/* table of pages: machines get company/year/type columns; companies are a plain list */}}
{{ if eq (index . 0).Section "companies" }}
{{/* table of pages: machines get company/year/type columns; companies are a plain list.
Takes the pages, or (dict "pages" … "head" true) to add the column headers (sortable). */}}
{{ $pages := . }}{{ $head := false }}
{{ if reflect.IsMap . }}{{ $pages = .pages }}{{ $head = .head }}{{ end }}
{{ if eq (index $pages 0).Section "companies" }}
<ul class="columns">
{{ range . }}
{{ range $pages }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a> <small>({{ len .Params.machines }})</small></li>
{{ end }}
</ul>
{{ else }}
<table class="list">
{{ if $head }}
<thead>
<tr><th>Name</th><th>Year</th><th>{{ if eq (index $pages 0).Section "software" }}Tags{{ else }}Type{{ end }}</th><th>Origin</th></tr>
</thead>
{{ end }}
<tbody>
{{ range . }}
{{ range $pages }}
<tr>
<td><a href="{{ .RelPermalink }}">{{ .Title }}</a></td>
<td>{{ partial "terms.html" (dict "page" . "taxonomy" "years") }}</td>